|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
removing specific characters on the file
hi. im new with shell scripting, please help me out.
i need to make a script that will scan/parse one file and remove characters/word within that file. for example, file "abcd" contains this text: "abcdefghijklmnopqrs lmnopqrsabcdfghijk poiuytrewqabcdmnbvcxz" i need to delete the string "abcd"and replace it with space , so that the output file looks like this: " efghijklmnopqrs lmnopqrs fghijk poiuytrewq mnbvcxz" im using HP-UX. thanks! |
|
#2
|
|||
|
|||
|
you could try this perl statement. It works on Solaris. No promises for HP-UX though:
perl -i -pe "s/abcd/ /g" filename |
|
#3
|
|||
|
|||
|
cat abcd.txt | sed "s/abcd/ /g" >>junk.txt; mv junk.txt abcd.txt;
if you donot want the file to be changed then you can simply use cat abcd.txt| sed "s/abcd/ /g" to get the output Regards
__________________
Regards JK |
|
#4
|
|||
|
|||
|
Quote:
Use "cat junk.txt > abcd.txt" instead of the "mv" command. This way will not change the file's permissions. hth, M.
__________________
-- Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > removing specific characters on the file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|