Find the answer to your Linux question:
Results 1 to 2 of 2
Hi everybody, I have a text file contains data(including some dates and some matter) . i want to change the date( which is in 02-02-82 format ) in the file ...
  1. #1
    Linux Newbie
    Join Date
    Oct 2006
    Posts
    107

    Scripting doubt

    Hi everybody,

    I have a text file contains data(including some dates and some matter) .

    i want to change the date( which is in 02-02-82 format ) in the file where ever it is appeared to (03-03-0...


    How we can do that ..

    pls help me out......
    Thanks in Advance.......

  2. #2
    Linux Newbie
    Join Date
    Jan 2008
    Location
    UK
    Posts
    211
    Hi Mallik,
    If you want to change for example 02-02-82 to 03-03-07 do this:
    on the command line in a shell type:
    perl -p -i -e 's/02-02-82/03-03-07/g' myfile
    myfile could be /home/fred/myfile.txt
    and to back up original file add a suffix to the -i option. -i.bak.

    Hope this helps

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...