Search Results

Search: Posts Made By: antosr7
1,845
Posted By jim mcnamara
# expanded lines and fixed errors awk '{...
# expanded lines and fixed errors
awk '{ arr[NR]=$0;
if (index($0,"union all")>0)
{L=NR}
}
END {
gsub(/union all/, "", arr[L])
for(i=0; i<NR; i++)
...
1,845
Posted By Don Cragun
Does Centos have the ex utility? If so, for the...
Does Centos have the ex utility? If so, for the features I used in the ed script in post #3, ex will work the same way with the same options. On UNIX, Linux, and BSD systems, I usually use ed...
1,845
Posted By JiaHong
Hi antosr7, This may be one of the methods: ...
Hi antosr7,

This may be one of the methods:

grep "test3" <input_filename> | sed "s/ union all/;/"

where the test3 is the keyword to extract the line and the <filename> is where the three...
1,845
Posted By Don Cragun
Another way: ed -s infile <<-EOF ?union...
Another way:
ed -s infile <<-EOF
?union all?s//;/
w outfile
q
EOF
where infile and outfile, respective, are pathnames to your input and output files.

You can just use:
w
instead of:...
1,845
Posted By jim mcnamara
One way: awk '{ arr[NR]=$0; index($0,"union...
One way:

awk '{ arr[NR]=$0; index($0,"union all")>0 {L=NR} }
END { gsub(/union all/, "", arr{L})
for(i=0; i<NT; i++)
{print arr[i])
}' infile > outfile...
Showing results 1 to 5 of 5

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