Keith Birchfield wrote: > Hello all, and thanks for previous help! :-) > > Can anyone give me a csh cheat to copy a file with a specific string > replaced with another? > > For example > copy foo1.txt to foo2.txt and replace each instance of "blue" with > "red" where > foo1.txt contains > apple > blue syrup > green apples > blue > red grapes > grapes > > and the resulting foo2.txt contains > apple > red syrup > green apples > red > red grapes > grapes >
cat foo1.txt |sed 's/blue/red/' > foo2.txt If you have in foo1.txt the text 'bluegreen apples', the above would change it to be 'redgreen apples'. To separate out the words as single words do: cat foo1.txt |sed 's/blue /red /' > foo2.txt. Or do man sed for further information on ways to do the search and replace you are wanting to do. .~. Brad Sites /V\ Systems Administrator // \\ Missouri Employers Mutual Insurance /( )\ [EMAIL PROTECTED] www.mem-ins.com ^^-^^ (573) 499-4230 -- redhat-list mailing list unsubscribe mailto:[EMAIL PROTECTED] https://www.redhat.com/mailman/listinfo/redhat-list