![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to find a file named vijay in a directory using find command | amirthraj_12 | UNIX for Dummies Questions & Answers | 6 | 10-25-2008 09:37 AM |
| Can I know find syntax to find given date files | bache_gowda | Shell Programming and Scripting | 3 | 03-26-2008 03:37 AM |
| Little bit weired : Find files in UNIX w/o using find or where command | jatin.jain | Shell Programming and Scripting | 10 | 09-19-2007 03:47 AM |
| Find files older than 20 days & not use find | halo98 | Shell Programming and Scripting | 2 | 05-18-2006 11:19 AM |
| command find returned bash: /usr/bin/find: Argument list too long | yacsil | Shell Programming and Scripting | 1 | 12-15-2003 03:38 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
find and repalce
Hi i would like to know about find and replace command:
i have files like: temp1: Code:
unix windows Calender tools temp1: Code:
unix unix Calender tools Last edited by Yogesh Sawant; 04-04-2008 at 06:04 AM. Reason: added code tags |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
if you can use Perl:
Code:
perl -pi -e 's/windows/unix/' newfile |
|
#3
|
|||
|
|||
|
Here is a little script I use which does the same thing as Yogesh suggested. Simply call the script with oldvalue and newvalue -- every file in the directory will be updated so use with care
#!/bin/ksh case $# in 0) echo "\nUsage: replace oldvalue newvalue\n" exit 1 ;; *) echo "\n\n oldvalue: $1\t\t newvalue: $2\n\n" echo "================================================" echo "BEFORE" echo "================================================" grep $1 * perl -pi -e "s/$1/$2/g" * echo "================================================" echo "AFTER" echo "================================================" grep $2 * esac |
|||
| Google The UNIX and Linux Forums |
| Tags |
| perl |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|