Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sed taking too long 1

Status
Not open for further replies.

mpramods

Technical User
Jun 3, 2003
50
US
I have number of files with '{' and '}' in it. I need to replace every '{' and '}' in this file to space.

I am using the following in a script:

sed 's/{/ /g;s/}/ /g' >temp
mv temp $1

It is taking too long since the files are very huge and they have many of these characters to be replaced.
Is there any other fast way to achieve this.

Thanks,
Pramod
 
There was a typo in what I wrote earlier.

The script I am using is:

sed 's/{/ /g;s/}/ /g' $1 >temp
mv temp $1


Is there any way I can make it more effecient
 
Great feherke. My sed was taking 3-4 hrs for each file. Your script does the same in 2 minutes.

Awesome............. You Rock.

Thanks,
Pramod
 
Hi

By the way, [tt]sed[/tt] also has transliteration command, the [tt]y///[/tt]. This should also work faster then the [tt]s///[/tt] command.
Code:
sed 'y/{}/  /' /input/file > /output/file

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top