Re: Script to search an input file, insert a line and then update the file
- From: "Ralf Müller" <stark.dreamdetective@xxxxxxxxxxxxxx>
- Date: 16 Oct 2006 02:03:25 -0700
hiddenmarkov@xxxxxxxxx schrieb:
Hi,
Could any expert out there give me a hint / command used or even a
sample code in writing a script which can perform the function in the
subject line, i.e. read in a file, search for specific string, if the
string is found, insert a line and then close the file? Any suggestion
is appreciated.
NewB.
This sounds like 'in-place-edit'. Allthough it's not pure "shell", it's
quite good, to know these kind of oneliners:
perl -pi.bak -e 's/(search-patters)/$1(inserted-text)/' input_file
Best Regards
Ralf
.
- References:
- Script to search an input file, insert a line and then update the file
- From: hiddenmarkov
- Script to search an input file, insert a line and then update the file
- Prev by Date: Re: Replacing an instruction in all project files part II
- Next by Date: Re: sed: filter by line number and pattern
- Previous by thread: Re: Script to search an input file, insert a line and then update the file
- Next by thread: Re: Script to search an input file, insert a line and then update the file
- Index(es):
Relevant Pages
|