Mar 4, 2002 #1 vti Technical User Joined Feb 26, 2001 Messages 189 Location 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 Joined Jul 27, 2000 Messages 2,146 Location 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 Joined Feb 26, 2001 Messages 189 Location 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 Joined Feb 14, 2002 Messages 758 Location 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 Joined Feb 26, 2001 Messages 189 Location TR thanks a lot ,both of these works. Upvote 0 Downvote