The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Using Find w/ Grep? beefeater267 Shell Programming and Scripting 2 01-24-2009 07:05 AM
Help using find/grep Rally_Point UNIX for Dummies Questions & Answers 4 12-18-2008 03:34 AM
find , grep james94538 UNIX for Dummies Questions & Answers 3 10-09-2008 10:03 PM
grep, find or awk? netrom UNIX for Dummies Questions & Answers 4 04-09-2008 06:03 PM
grep and find MEllis5 UNIX for Dummies Questions & Answers 1 04-07-2008 09:16 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-19-2009
Scrutinizer Scrutinizer is online now
Registered User
  
 

Join Date: Nov 2008
Posts: 728
Quote:
Originally Posted by nxvir View Post
i need to put the find result to text file is this right


Code:
 xargs egrep -l "blue|red|yellow" > temp.txt

then after that

for x in `cat temp.txt` do; 
sed -i 's/blue/black/g' $x; 
sed -i 's/yellow/black/g' $x; 
sed -i 's/red/black/g' $x; 
done

Code:
for x in `cat temp.txt`; do
  sed -i 's/blue/black/g' $x
  sed -i 's/yellow/black/g' $x
  sed -i 's/red/black/g' $x
done

Although the preferred method would be to use "while read"

Code:
while read x ; do
  sed -i 's/\(blue\|red\|yellow\)/black/g' "$x"
done < temp.txt

Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:17 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0