Sponsored Content
Top Forums Shell Programming and Scripting Print specific lines of a repeated set of data Post 302607180 by jim mcnamara on Tuesday 13th of March 2012 10:56:00 PM
Old 03-13-2012
assuming your given counts are correct and there are no blank lines in the file
Code:
awk '{
        cnt++
        if(cnt==1 | cnt ==2 || cnt==26) {print $0; cnt=(cnt==26)?0 :cnt}
        else {next}

       }' inputfile > outputfile

try that on your data
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to print specific lines with awk

Hi! How can I print out a specific range of rows, like "cat file | awk NR==5,NR==9", but in the END-statement? I have a small awk-script that finds specific rows in a file and saves the line number in an array, like this: awk ' BEGIN { count=0} /ZZZZ/ { list=NR ... (10 Replies)
Discussion started by: Bugenhagen
10 Replies

2. Shell Programming and Scripting

print specific lines

I have a text file made of different blocks separated by blank lines. I need to print the blocks with odd indexes. How can I get it with awk? For example i need to print the first and the third block of a file like this: asgdg sadsd ssgsdgd ass uff fedd sddddso ieeduydd dddee deeo ssancnc... (4 Replies)
Discussion started by: littleboyblu
4 Replies

3. Shell Programming and Scripting

print first few lines, then apply regex on a specific column to print results.

abc.dat tty cpu tin tout us sy wt id 0 0 7 3 19 71 extended device statistics r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b device 0.0 133.2 0.0 682.9 0.0 1.0 0.0 7.2 0 79 c1t0d0 0.2 180.4 0.1 5471.2 3.0 2.8 16.4 15.6 15 52 aaaaaa1-xx I want to skip first 5 line... (4 Replies)
Discussion started by: kchinnam
4 Replies

4. Shell Programming and Scripting

print running field average for a set of lines

Hi everyone, I have a program that generates logs that contains sections like this: IMAGE INPUT 81 0 0.995 2449470 0 1726 368 1 0.0635 0.3291 82 0 1.001 2448013 0 1666 365 1 0.0649 0.3235 83 0 1.009 2444822 0 1697 371 1 ... (3 Replies)
Discussion started by: euval
3 Replies

5. Shell Programming and Scripting

Extracting specific lines of data from a file and related lines of data based on a grep value range?

Hi, I have one file, say file 1, that has data like below where 19900107 is the date, 19900107 12 144 129 0.7380047 19900108 12 168 129 0.3149017 19900109 12 192 129 3.2766666E-02 ... (3 Replies)
Discussion started by: Wynner
3 Replies

6. Shell Programming and Scripting

Print Specific lines when found specific character

Hello all, I have thousand file input like this: file1: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$ | | | |$$ $$ UERT | TTYH | TAFE | FRFG |$$ $$______|______|________|______|$$ $$ | | | |$$ $$ 1 | DISK | TR1311 | 1 |$$ $$ 1 |... (4 Replies)
Discussion started by: attila
4 Replies

7. Shell Programming and Scripting

need to print lines between repeated pattern

Hi all, I have a file that looks like this: uid=bessemsj version: 1 dn: cn=Desk SpecialAdminDesk, ou=Desks, dc=DSS,c=nl,o=Vodafone dn: cn=DSS Advisors, ou=Groups, dc=DSS,c=nl,o=Vodafone dn: cn=DSS Dispatcher,ou=Groups,dc=DSS,c=nl,o=Vodafone dn: cn=Desk Retention Desk,ou=Desks,... (13 Replies)
Discussion started by: Eman_in_forum
13 Replies

8. Shell Programming and Scripting

How to print the lines which are repeated 3 times in a file?

Hello All, I have a file which has repeated lines. I want to print the lines which are repeated three times. Please help. (3 Replies)
Discussion started by: ailnilanjan
3 Replies

9. Shell Programming and Scripting

How to print the specific lines?

I need to print specific lines 5,100,67,123 in a file. file name: today.csv (3 Replies)
Discussion started by: ramkumar15
3 Replies

10. UNIX for Beginners Questions & Answers

How to print lines from a files with specific start and end patterns and pick only the last lines?

Hi, I need to print lines which are matching with start pattern "SELECT" and END PATTERN ";" and only select the last "select" statement including the ";" . I have attached sample input file and the desired input should be as: INPUT FORMAT: SELECT ABCD, DEFGH, DFGHJ, JKLMN, AXCVB,... (5 Replies)
Discussion started by: nani2019
5 Replies
hipercdecode(1) 					      General Commands Manual						   hipercdecode(1)

NAME
hipercdecode - Decode a HIPERC stream into human readable form. SYNOPSIS
hipercdecode [options] <hiperc-file DESCRIPTION
hipercdecode decodes a HIPERC stream into human readable form. Uncompressed and JBIG formats are handled. An HIPERC stream is the printer langauge used by the Oki Data C310dn, C3100, C3200n, C3250n, C3300n, C3400n, C5100n, C5250n, C5500n, C5600, and the C5800n printers. COMMAND LINE OPTIONS
These are the options that can appear on the command line. -d basename Basename of .pbm file for saving decompressed planes. -h Print hex file offsets. -o Print file offsets. -D level Set Debug level [0]. EXAMPLES
Decode an HIPERC stream file created by foo2hiperc. $ foo2hiperc-wrapper testpage.ps | hipercdecode -h 0: 33%-12345X@PJL f: @PJL RDYMSG DISPLAY = "Unknown" 30: @PJL SET OKIJOBACCOUNTJOB USERID="Unknown" JOBNAME="Unknown" 6e: @PJL SET OKIAUXJOBINFO DATA="DocumentName=Unknown" a2: @PJL SET OKIAUXJOBINFO DATA="ComputerName=dual.rkkda.org" dd: @PJL SET OKIAUXJOBINFO DATA="ReceptionTime=00:00:00 2008/01/30" 11e: @PJL SET OKIAUTOTRAYSWITCH=ON 13d: @PJL SET OKIPAPERSIZECHECK=ENABLE 160: @PJL SET RESOLUTION=600 179: @PJL SET PAPER=LETTER 190: @PJL SET OKITRAYSEQUENCE=PAPERFEEDTRAY 1b8: @PJL SET OKIPAPERFEED=TRAY1 1d5: @PJL SET OKIMEDIATYPE = PLAIN 1f4: @PJL SET LPARM:PCL OKIPRINTMARGIN=INCH1D6 21f: @PJL SET COPIES=1 232: @PJL SET QTY=1 242: @PJL SET HIPERCEFFECTIVEBLOCKSIZE=34799360 26e: @PJL ENTER LANGUAGE=HIPERC 289: RECTYPE 0 (len=52,0x34 cnt=1) 291: BLKNUM 0, nbie=1, pn=3 [black] uc=0,0, wid=4864 ud=0,100 2a5: BLKNUM 1 (len=20), uncompressed=1, bie: DL = 48, D = 48, P = 49, - = 48, XY = 4864 x 6816 L0 = 256, MX = 0, MY = 0 Order = 0 Options = 0 1 stripes, 0 layers, 49 planes 2bd: RECTYPE 1 (len=155668,0x26014 cnt=1) 2c5: BLKNUM 0 (len=4), plane=3, uc=0,0,0 2cd: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 262d1: RECTYPE 1 (len=155668,0x26014 cnt=2) 262d9: BLKNUM 0 (len=4), plane=3, uc=0,0,0 262e1: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 4c2e5: RECTYPE 1 (len=155668,0x26014 cnt=3) 4c2ed: BLKNUM 0 (len=4), plane=3, uc=0,0,0 4c2f5: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 722f9: RECTYPE 1 (len=155668,0x26014 cnt=4) 72301: BLKNUM 0 (len=4), plane=3, uc=0,0,0 72309: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 9830d: RECTYPE 1 (len=155668,0x26014 cnt=5) 98315: BLKNUM 0 (len=4), plane=3, uc=0,0,0 9831d: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... be321: RECTYPE 1 (len=155668,0x26014 cnt=6) be329: BLKNUM 0 (len=4), plane=3, uc=0,0,0 be331: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... e4335: RECTYPE 1 (len=155668,0x26014 cnt=7) e433d: BLKNUM 0 (len=4), plane=3, uc=0,0,0 e4345: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 10a349: RECTYPE 1 (len=155668,0x26014 cnt=8) 10a351: BLKNUM 0 (len=4), plane=3, uc=0,0,0 10a359: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 13035d: RECTYPE 1 (len=155668,0x26014 cnt=9) 130365: BLKNUM 0 (len=4), plane=3, uc=0,0,0 13036d: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 156371: RECTYPE 1 (len=155668,0x26014 cnt=10) 156379: BLKNUM 0 (len=4), plane=3, uc=0,0,0 156381: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 17c385: RECTYPE 1 (len=155668,0x26014 cnt=11) 17c38d: BLKNUM 0 (len=4), plane=3, uc=0,0,0 17c395: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 1a2399: RECTYPE 1 (len=155668,0x26014 cnt=12) 1a23a1: BLKNUM 0 (len=4), plane=3, uc=0,0,0 1a23a9: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 1c83ad: RECTYPE 1 (len=155668,0x26014 cnt=13) 1c83b5: BLKNUM 0 (len=4), plane=3, uc=0,0,0 1c83bd: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 1ee3c1: RECTYPE 1 (len=155668,0x26014 cnt=14) 1ee3c9: BLKNUM 0 (len=4), plane=3, uc=0,0,0 1ee3d1: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 2143d5: RECTYPE 1 (len=155668,0x26014 cnt=15) 2143dd: BLKNUM 0 (len=4), plane=3, uc=0,0,0 2143e5: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 23a3e9: RECTYPE 1 (len=155668,0x26014 cnt=16) 23a3f1: BLKNUM 0 (len=4), plane=3, uc=0,0,0 23a3f9: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 2603fd: RECTYPE 1 (len=155668,0x26014 cnt=17) 260405: BLKNUM 0 (len=4), plane=3, uc=0,0,0 26040d: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 286411: RECTYPE 1 (len=155668,0x26014 cnt=18) 286419: BLKNUM 0 (len=4), plane=3, uc=0,0,0 286421: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 2ac425: RECTYPE 1 (len=155668,0x26014 cnt=19) 2ac42d: BLKNUM 0 (len=4), plane=3, uc=0,0,0 2ac435: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 2d2439: RECTYPE 1 (len=155668,0x26014 cnt=20) 2d2441: BLKNUM 0 (len=4), plane=3, uc=0,0,0 2d2449: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 2f844d: RECTYPE 1 (len=155668,0x26014 cnt=21) 2f8455: BLKNUM 0 (len=4), plane=3, uc=0,0,0 2f845d: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 31e461: RECTYPE 1 (len=155668,0x26014 cnt=22) 31e469: BLKNUM 0 (len=4), plane=3, uc=0,0,0 31e471: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 344475: RECTYPE 1 (len=155668,0x26014 cnt=23) 34447d: BLKNUM 0 (len=4), plane=3, uc=0,0,0 344485: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 36a489: RECTYPE 1 (len=155668,0x26014 cnt=24) 36a491: BLKNUM 0 (len=4), plane=3, uc=0,0,0 36a499: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 39049d: RECTYPE 1 (len=155668,0x26014 cnt=25) 3904a5: BLKNUM 0 (len=4), plane=3, uc=0,0,0 3904ad: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 3b64b1: RECTYPE 1 (len=155668,0x26014 cnt=26) 3b64b9: BLKNUM 0 (len=4), plane=3, uc=0,0,0 3b64c1: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 3dc4c5: RECTYPE 1 (len=97300,0x17c14 cnt=27) 3dc4cd: BLKNUM 0 (len=4), plane=3, uc=0,0,0 3dc4d5: BLKNUM 1 (len=97280), Data=00 00 00 00 00 00 00 00 00 00 00 ... 3f40d9: RECTYPE 255 (len=8,0x8 cnt=28) 3f40e1: 33%-12345X FILES
/usr/bin/hipercdecode SEE ALSO
foo2hiperc-wrapper(1), foo2hiperc(1) AUTHOR
Rick Richardson <rick.richardson@comcast.net> http://foo2hiperc.rkkda.com/
All times are GMT -4. The time now is 07:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy