LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 07-17-2006, 10:52 AM   #1
odysseus.lost
LQ Newbie
 
Registered: Jun 2005
Distribution: FC1-3, Ubuntu 6.06
Posts: 20

Rep: Reputation: 0
bash script with grep and sed: sed getting filenames from grep


Hi I have the following script:

Code:
grep -iH csunix $1
sed 's#/home/csunix/menig/LOCAL_PARTITION/#/usr/not-backed-up/////////////////#g' $1 > $1.tmp && mv $1.tmp $1
echo "Replaced LOCAL_PARTITION"
sed 's#/home/csunix/menig/#/usr/not-backed-up/#g' $1 > $1.tmp && mv $1.tmp $1
echo "Replaced menig"
grep -i csunix $1
echo "OK"
1. I would like the files to be passed to sed to be the output of grep... rather than passing one by one from the command line...
2. How can I preserve the file permissions which are getting lost...

Any clues?

Cheers!

Last edited by odysseus.lost; 07-17-2006 at 10:54 AM.
 
Old 07-17-2006, 12:36 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,743
Blog Entries: 54

Rep: Reputation: 2972Reputation: 2972Reputation: 2972Reputation: 2972Reputation: 2972Reputation: 2972Reputation: 2972Reputation: 2972Reputation: 2972Reputation: 2972Reputation: 2972
/home/csunix
If you don't mind me asking, is this sposed to be your homework?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sed or grep : delete lines containing matching text raj000 Linux - General 18 09-08-2012 10:38 AM
How can I awk/sed/grep the IPs from the maillog? abefroman Programming 7 03-09-2006 11:22 AM
bash script and grep syros Programming 4 01-13-2005 04:04 PM
Simple Text Reformat (sed and grep) mikefazz Programming 2 08-31-2004 08:38 PM
sed & grep script? dolvmin Linux - Software 20 09-22-2003 07:30 AM


All times are GMT -5. The time now is 01:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration