This is a bunch of examples I use as reference on occasion.
Of course use regular expressions liberally...
\ Escape character, to indicate next character is not to be considered
special metacharacters
& Shortcut, to replace with pattern matches...
. Any single character (wildcard)
^ beginnging of line anchor
$ end of line anchor
On right side of substitute command, metacharacters usually are literals...
1,$command - function will operate on entire file
/dog/command - function will operate on lines containing dog
/dog/,$command - function will operate on lines from 1st containing dog to
end of file.
sed '/west/d' <filename> - Delete all lines containing west.
sed 's/ \.9./& */' <filename> - substitute ".9" followed by 1 anything with
same space *
sed '/west/,/east/s/.$/& eol/' <filename> - from 1st west to 1st east
replace last anything with same space eol
sed '2d' <filename> - delete line 2
sed '2,5d' <filename> - delte lines 2 - 5
sed '^[ ]*$/d' <filename> *In blank was space,tab - delete blank
spaced or tabbed lines from a file.
sed '/Beal/r enclosure' <filename> - puts enclosure file in filename after
"Beal"
sed -e '/west/d' -e 's/CT/CE/' <filename> - delete west, and replace CT with
CE
sed -n '/west/w newdata' <filename> - suppress normal output, but write
lines with west to newdata
sed -n '4,8p' <filename> - suppress normal output, print lines 4-8
sed -f sedscript <filename> - run "sedscript" on filename
sed 's/\([a-zA-Z]*\) \([0-9]*\)/ \2 \1/' <filename> - any words with upper
or lower letters, and reverse them with any numbers. *wont work for me
sed -e 's/De.*son/Frank Marcus' -e '/west/d' -e 's/ [0-9] / /' <filename> -
replace De*son w/Frank Marcus, delete west lines, remove 1st occurance of
any 0-9 digit.
sed '/NO/c\ Crappity crap crap' <filename> - change any line w/NO to
Crappity, etc.
For your file, try:
sed 's/"//g' <filename> > newfile.out
-Good Luck
RYAN
-----Original Message-----
From: Dan B [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 10, 2001 3:06 PM
To: [EMAIL PROTECTED]
Subject: Script (sed/perl) to remove all quotes (") from a file?
Can anyone give me a quick reference for building a script that removes all
quotes (" symbols) from a given file?
I imagine a sed or perl script could do it. Is there any good free
books/online resources that teach that kind of stuff? (Besides 'man sed'?)
Thanks,
Dan Browning, Cyclone Computer Systems, [EMAIL PROTECTED]
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list