LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 09: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 09:54 AM.
 
Old 07-17-2006, 11:36 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

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


Reply



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 09:38 AM
How can I awk/sed/grep the IPs from the maillog? abefroman Programming 7 03-09-2006 10:22 AM
bash script and grep syros Programming 4 01-13-2005 03:04 PM
Simple Text Reformat (sed and grep) mikefazz Programming 2 08-31-2004 07:38 PM
sed & grep script? dolvmin Linux - Software 20 09-22-2003 06:30 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:52 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
Open Source Consulting | Domain Registration