LinuxQuestions.org
Support LQ: Use code LQCO20 and save 20% on CrossOver Office
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
 
LinkBack 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: 21,604
Blog Entries: 47

Rep: Reputation: 1413Reputation: 1413Reputation: 1413Reputation: 1413Reputation: 1413Reputation: 1413Reputation: 1413Reputation: 1413Reputation: 1413Reputation: 1413
/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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sed or grep : delete lines containing matching text raj000 Linux - General 17 01-18-2010 08:22 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


All times are GMT -5. The time now is 11:14 AM.

Main Menu
 
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
Open Source Consulting | Domain Registration