Search Results

Search: Posts Made By: repudi8or
1,429
Posted By repudi8or
erm... ok... i got something sort of working but...
erm... ok... i got something sort of working but its a bit horrible to read :-

$ nawk -F' |:|\t' '/^These/ {f=0} /packages installed on the source/ {f=1} { if ( f==1 ) {print $0} } '...
1,429
Posted By repudi8or
awk help please
My source file looks like this :-
These packages installed on the source system are inconsistent with this system:
SUNWscsa1394: not installed
...
3,354
Posted By repudi8or
sigh, wish i had checked sed first.... $ sed...
sigh, wish i had checked sed first....

$ sed "/bbbb/ r $f2" < $f1
aaaa
bbbb
1111
2222
3333
4444
cccc
dddd
eeee


The last step is to get the file inserted BEFORE the pattern........
3,354
Posted By repudi8or
ok i found something that works. ed -s...
ok i found something that works.

ed -s file1 <<< $'/bbbb/ r file2\n,p' # to stdout
or
ed -s file1 <<< $'/bbbb/ r file2\n,w' # to directly update file1

results in the output being:-
aaaa...
2,442
Posted By repudi8or
Thanks Ygor, that was much neater than what i was...
Thanks Ygor, that was much neater than what i was doing.
3,354
Posted By repudi8or
insert file2 after line containing patternX in file1
file1:-
aaaa
bbbb
cccc
dddd
eeee

file2:-
1111
2222
3333
4444

I want to insert file2 after pattern bbbb to come up with a finished file of :-
aaaa
bbbb
1111
2222
3333
4444
2,902
Posted By repudi8or
maybe something like :- filename=$1 ...
maybe something like :-

filename=$1
uperms=`ls -l $filename|cut -c2-4`
gperms=`ls -l $filename|cut -c5-7`
operms=`ls -l $filename|cut -c8-10`

then you can case for the responses you want or...
2,442
Posted By repudi8or
print pattern line +2 without tabs or brackets
This works, but its messy. Any suggestions for a elegant solution? :-

me@myserver $ head zoneAttachOutfile
These packages installed on the source system are inconsistent with this system:
...
10,379
Posted By repudi8or
much more elegant, thanks radoulov I will...
much more elegant, thanks radoulov

I will use that
10,379
Posted By repudi8or
I tried that solution :- me@myserver $ nawk '...
I tried that solution :- me@myserver $ nawk ' BEGIN { flag = 0} /^<bag name="mybag2"/ { flag = 1} /^<bag name="mybag3"/ { flag = 0} { if (flag == 0) { print; }}' test2

<bag name="mybag1"...
10,379
Posted By repudi8or
how to delete text from line starting pattern1 up to line before pattern2?
My data is xml'ish (here is an excerpt) :-
<bag name="mybag1" version="1.0"/>
<contents id="coins"/>
<bag name="mybag2" version="1.1"/>
<contents id="clothes"/>
<contents id="shoes"/>...
Showing results 1 to 11 of 11

 
All times are GMT -4. The time now is 02:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy