tips on everything. share, find, keep.
login | register | blog | about
    

Tip

replacing string within file (linux)

perl -i~ -pe 's/abc/def/g' filename

Will replace the string abc with def in the file itself, and generate a backup of the original file in filename~. This command reads text from the file filename and writes it back into the same file where every occurrence of the string abc is replaced by def. The original contents of filename are copied into the file filename~.

posted on 2006-04-03 | comments(1) | save

tags: linux, file manipulation, perl

Comments


posted at 2006-04-08 by maozdan

linux rulz !! :)

Add comment