![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| find and replace | javeed7 | Shell Programming and Scripting | 1 | 04-02-2008 06:00 AM |
| find and replace | rakshit | Shell Programming and Scripting | 4 | 01-24-2008 12:52 AM |
| find and replace | mahabunta | UNIX for Dummies Questions & Answers | 7 | 09-21-2006 09:05 AM |
| find and replace | vikas_j@hotmail | UNIX for Dummies Questions & Answers | 3 | 02-25-2002 02:41 PM |
| Find & Replace | gagansharma | Shell Programming and Scripting | 3 | 11-27-2001 01:17 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
find and replace
I have a file that I want to remove all of the periods from. I am using the below to remove quotations and it works fine -I thought I could make it work for the period but it does not. Any help would be appreciated.
works to remove the double quote mark (") sed -e 's/"//g' input file >output file tried sed -e 's/.//g' input file >output file and sed -e 's/"."//g' input file >output file valhutch |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Code:
sed -e 's/[.]//g' input file >output file |
|
#3
|
|||
|
|||
|
Hi
Hey What if you donot want to redirect the file and instead just read the existing file and replace what ever you wanna do and then save it ?....
any ideasss ?? |
|
#4
|
|||
|
|||
|
sed - edit files in place
Some versions of 'sed' support in-place editing using the '-i' option, while others do not.
An alternative is using perl from the command line ( assuming it's installed ), and using the '-i -pe' options. '-i' edits files in place. '-e' allows you to define Perl code to be executed '-p' loops around every line in the file and performs the substitution This will remove all period characters from the file "input_file". Code:
perl -i -pe 's/[.]//g' input_file Code:
sed -e 's/\.//g' |
|
#5
|
||||
|
||||
|
The new -i option for sed stands for edit files in place:
$ sed -i -e 's/\.//g' input_file Note: $ sed --version GNU sed version 4.1.5 Your sed may not have this option |
||||
| Google The UNIX and Linux Forums |