Register
It is currently Fri Nov 21, 2014 1:06 pm

if statement help


All times are UTC - 6 hours


Post new topic Reply to topic  [ 4 posts ] 
Author Message
 PostPosted: Sat May 04, 2013 7:48 pm   

Joined: Sat May 04, 2013 7:40 pm
Posts: 2
I'm trying to make an if statement that would be true if the line that is being read starts with the word "crush". Then if so, crush would be deleted with the sed function and the word apple would change to orange.



find . -type f -exec \

sed -i -e 's/^crush//g' \
-e 's/apple/orange/g' {} \;


Top
 Profile  
 PostPosted: Sat May 04, 2013 9:08 pm   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 567
hello, please, thank you ?

you're allowed to be polite!

Quote:
I'm trying to make an if statement that would be true if the line that is being read starts with the word "crush". Then if so, crush would be deleted with the sed function and the word apple would change to orange.

Code:
find . -type f -exec sed -i -e 's/^crush//g' -e 's/apple/orange/g' {} \;
and then?


Top
 Profile  
 PostPosted: Sat May 04, 2013 9:47 pm   

Joined: Sat May 04, 2013 7:40 pm
Posts: 2
Thanks for responding.

...and then the lines on the files that have "crush" at the beginning would be updated with orange instead of apple.

I just noticed there isn't much movement on this board, I'll be logging out and not coming back so this answer isn't worth answering!


Top
 Profile  
 PostPosted: Sun May 05, 2013 9:33 pm   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 669
Location: Des Moines, Iowa
I'm sure the answer wouldn't be in time for you, sometimes you just have to buckle down and do your own homework :)


Top
 Profile WWW  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP