Hi there,
I think this was the correct forum. At least it's the one I use.
If your not very familiar with sed, here are some remarks:
1) You can put all the replacements in one sed
2) Without the g option, only the first occurence of the string in each line will be replaced. I know it's not very likely to have "Ave." appear two times in an address, but you'd better be sure
3) You don't need to cat the file, just give it as an argument
4) And if you want to replace the file itself, use the i switch
5) Beware that a period (.) is a special character that represent any other one. Which means that Aven, Avel, Aved all match Ave. and will be replaced by Avenue. Escape the period to match an actual period.
I hope I helped
Santiago
I'm trying to write a program that will open an existing file supplied by the command line argument and then replace words with "We" or "we" by "I" and "a" or "A" by "The". When I run the program it reads the file, changes the word but re writes it on a new line with only the replaced words not the... (1 Reply)
Hi,
I have the following codes below that aims to delete every words between two pattern word. Say I have the files
To delete every word between WISH_LIST=" and " I used the below codes (but its not working):
#!/bin/sh
sed '
/WISH_LIST=\"/ {
N
/\n.*\"/ {... (3 Replies)
Hi, I have am using a file that contains names that I want to replace.
Basically file 1 looks like this
jack
joe
james
john
I have another file (file 2) that looks like this
jack 2345
joe 6848
james 3342
john 3432
Basically I want to replace column1 from file1... (4 Replies)
Hi all,
I have a file like
one two three for
five six seven eight
.....
Actually i need to append a label to the words that belong to the 2 column and get:
one two_label three for
five six_label seven eight
....
I was trying with sed inside vim but I can't figure out... (9 Replies)
Hi all,
I want to make an script using sed that removes everything between 'begin' (including the line that has it) and 'end1' or 'end2', not removing this line.
Let me paste an 2 examples:
anything before
any string begin
few lines of content
end1
anything after
anything before
any... (4 Replies)
My need is :
Want to change
docBase="/something/something/something"
to
docBase="/only/this/path/for/all/files"
I have some (about 250 files)xml files.
In FileOne it contains
<Context path="/PPP" displayName="PPP" docBase="/home/me/documents" reloadable="true" crossContext="true">... (1 Reply)
Hello All
Probably this is very simple for you but I cant figure it out
I have to replace "No Header" with "Output Field Names"
I/P file
<ATTRIBUTE NAME ="Header Options" VALUE ="No Header"/>
O/P needed
<ATTRIBUTE NAME ="Header Options" VALUE = "Output Field Names"> (4 Replies)
I have an assignment and I am not sure what to do.
In Unix, I use PuTTY
change the semicolon (;) to a period, and capitalize the first letter of the word immediately after it.
I know change command is M-% and "." so only one semicolon is changed but I am not sure how to... (1 Reply)
I have 4000 files like
$cat clus_grp_seq10_g.phy
18 1002
anig_OJJ65951_1 ATGGTTTCGCAGCGTGATAGAGAATTGTTTAGGGATGATATTCGCTCGCGAGGAACGAAGCTCAATGCTGCCGAGCGCGAGAGTCTGCTAAGGCCATATCTGCCAGATCCGTCTGACCTTCCACGCAGGCCACTTCAGCGGCGCAAGAAGGTTCCTCG
aver_OOF92921_1 ... (1 Reply)