[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: shell scripting....
- From: robert_gasch peoplesoft com
- To: redhat-install-list redhat com
- Subject: Re: shell scripting....
- Date: Wed, 28 Jul 1999 08:33:23 GMT
> how do i do the following in some bash shell scripts i am writing...?
> 1) append text to the end of a file?
ls > outputfile will re-create the file and send to output of ls
to it
ls >> outputfile will open the file and *append* the output of ls
> 2) search a file for a certain name or text string and then remove it
from
> the file...?
Searching is easy:
grep pattern file use grep -i for case insensitive searching
As for removing: a bit more subtle. If you know your string is unique, you
can do
cat orig_file | grep -v pattern > new_file
grep -v will strip the pattern you specify, but it will strip the entire
line ... for
more contrived things (just a word on a line) use vi (or any other text
editor)
or you'd have to write some short awk/perl scripts ...
> the system i am running is Redhat 6.0... and any help would be great.
All of this should work on any UNIX type system ...
Greetings
--> Robert
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]