Mar 4, 2002 #1 vti Technical User Feb 26, 2001 189 TR hi again. I would like to replace a specific word in a file with a new word.For example: My file look like : Monday Tuesday Saturday Thursday Friday Sunday I want to replace Saturday with Wednesday but how ? Thanks for any help..
hi again. I would like to replace a specific word in a file with a new word.For example: My file look like : Monday Tuesday Saturday Thursday Friday Sunday I want to replace Saturday with Wednesday but how ? Thanks for any help..
Mar 4, 2002 #2 vgersh99 Programmer Jul 27, 2000 2,146 US { gsub("Saturday", "Wednesday" print } vlad NOTE: when in doubt - "man awk" Upvote 0 Downvote
{ gsub("Saturday", "Wednesday" print } vlad NOTE: when in doubt - "man awk"
Mar 4, 2002 Thread starter #3 vti Technical User Feb 26, 2001 189 TR it works well but it's only print out on the screen ,when i edit the file again it is still wrong.How can i save the file.? Thanks a lot Upvote 0 Downvote
it works well but it's only print out on the screen ,when i edit the file again it is still wrong.How can i save the file.? Thanks a lot
Mar 4, 2002 #4 dickiebird Programmer Feb 14, 2002 758 GB You could use sed instead : sed "s/Saturday/Wednesday/g" oldfile > newfile then rename newfile to oldfile ( having saved it of course) DickieBird Upvote 0 Downvote
You could use sed instead : sed "s/Saturday/Wednesday/g" oldfile > newfile then rename newfile to oldfile ( having saved it of course) DickieBird
Mar 4, 2002 Thread starter #5 vti Technical User Feb 26, 2001 189 TR thanks a lot ,both of these works. Upvote 0 Downvote