file.txt contains below:
lines starting with A are start of a recordset till we reach the next line starting with A. so in this file, i have 3 recordsets.
now from each recordset, I want to print first 2 lines, if there is no line starting with X in the recordset.
for example: from this file, i need to print:
but i dont need to print:
because there is no line starting with W in this recordset.
Last edited by Scrutinizer; 03-08-2016 at 04:44 PM..
Reason: code tags
file.txt can have lines starting with either A,I,X,W,C,P, ignoring header line starting with H at the beginning of the file
and footer line starting with E at the end of file.
lines starting with A are start of a recordset till we reach the next line starting with A.
in the example i have given, tehre are 3 recordsets.
I want to print first 2 lines of those recordsets, for which there is no X line, whenever there is a W line.
so in the above 3 recordsets i need to print only the 2nd one:
i.e.
i am trying with awk.
Last edited by Scrutinizer; 03-08-2016 at 04:45 PM..
e.g.
File name: File.txt
cat File.txt
Result:
#INBOUND_QUEUE=FAQ1
INBOUND_QUEUE=FAQ2
I want to get the value for one which is not commented out.
Thanks, (3 Replies)
hello!
could u, please, help:
i have a file that includes 6 columns space delimited
1 rs4477212 0 82154 0 T
1 rs6680825 0 91472 0 G
1 rs9326626 0 570178 0 T
1 rs12123356 0 724702 0 C
I need to extract to a separate file lines... (5 Replies)
Data file example
I look for primary and * to isolate the interesting slot number.
slot=`sed '/^primary$/,/\*/!d' filename | tail -1 | sed s'/*//' | awk '{print $1" "$2}'`
Now I want to get the Touch line for only the associate slot number, in this case, because the asterisk... (2 Replies)
Hi Guys..
I have a file and i want to extract all words that starts with a pattern 'ABC_' or 'ADF_'
For example,
ABC.txt
----
INSERT INTO ABC_DLKFJAL_FJKLD
SELECT DISTINCT S,B,C FROM ADF_DKF_KDFJ_IERU8 A, ABC_LKDJFREUE9_FJKDF B
WHERE A.FI=B.EI;
COMMIT;
Output : ABS_DLKFJAL_FJKLD,... (5 Replies)
Ok, I should know how to do this...
I want to run crontab -l and pipe it through sed so that only those lines that do not have a # as the first character show on the screen... I know Ive doen this before but its been a decade since I scripted anything
Im working in AIX 7.1 using the crontab... (3 Replies)
I have hundreds of files to process. In each file
I need to look for a pattern then
extract value(s) from next line and then
search for value(s) selected from point (2) in the same file at a specific position.
HEADER ELECTRON TRANSPORT 18-MAR-98 1A7V
TITLE CYTOCHROME... (7 Replies)
Hi,
I have a file such as:
---
>contig00001 length=35524 numreads=2944
gACGCCGCGCGCCGCGGCCAGGGCTGGCCCA
CAGGCCGCGCGGCGTCGGCTGGCTGAG
>contig00002 length=4242 numreads=43423
ATGCCGAAGGTCCGCCTGGGGCTGG
CGCCGGGAGCATGTAGCG
---
I would like to concatenate the lines not starting with ">"... (9 Replies)
Hi ,
I have a huge file like this
=245 this is testing
=035 abc123
=245 this is testing1
=035 abc124
=245 this is testing2
=035 abc125
=035 abc126
=245 this is testing3
here i have to pull out those lines having two =035 instead of alternative 035 and 245 i.e extract... (18 Replies)