sed

Please support our Shell Scripting advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Sep 2009
Posts: 98
Reputation: Kruptein is an unknown quantity at this point 
Solved Threads: 5
Kruptein's Avatar
Kruptein Kruptein is offline Offline
Junior Poster in Training

sed

 
-1
  #1
Oct 4th, 2009
What am I doing wrong?
  1. for filename in /home/darragh/public_html/test/*
  2. do
  3. sed -i 's/..\/config/.\/config/g'
  4. done;

It just gives me: sed: No input files
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,373
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 608
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast

Re: sed

 
0
  #2
Oct 5th, 2009
Forgetting to give the filename to sed:
Shell Scripting Syntax (Toggle Plain Text)
  1. for filename in /home/darragh/public_html/test/*
  2. do
  3. sed -i 's/..\/config/.\/config/g' ${filename}
  4. done;
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 98
Reputation: Kruptein is an unknown quantity at this point 
Solved Threads: 5
Kruptein's Avatar
Kruptein Kruptein is offline Offline
Junior Poster in Training

Re: sed

 
0
  #3
Oct 5th, 2009
Okay that is probably right, but now it says I don't have permission, which is right because I made those files as root, but if I do sudo for ... then it says unknown command for...

What to do know?
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,373
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 608
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast

Re: sed

 
0
  #4
Oct 5th, 2009
Run the script as root or modify your script. 'for' is just a bash command for looping what you need elevated privelages for is possibly the 'ls' and the sed:
Shell Scripting Syntax (Toggle Plain Text)
  1. for filename in `sudo /home/darragh/public_html/test/*`
  2. do
  3. sudo sed -i 's/..\/config/.\/config/g' ${filename}
  4. done;
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Shell Scripting Forum
Thread Tools Search this Thread



Tag cloud for Shell Scripting
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC