Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • vishal.rossi
    Member
    • Apr 2013
    • 25

    Extracting specific lines/rows with awk

    I have to extract the line/row which begins with 1 10515 15143 128 2....and so on. The file is huge and doesn't begin with 1 in all the cases.

    Can anyone tell me how to extract with awk or with some other command.
    Thanks


    HWI-ST0764:99:C0BV6ACXX:4:1204:6906:61789 83 1 15143 0 = 14831 -406 Library0
    HWI-ST0764:99:C0BV6ACXX:4:2107:4589:43565 83 1 15176 41 = 14914 -362 Library0
    ---------------------------------------------
    1 15015 15143 128 2 3.00995 >Deletion_xxx_00000000<

    HWI-ST0764:99:C0BV6ACXX:4:2301:8245:154739 83 1 16419 16 = 16094 -425 Library0
    HWI-ST0764:99:C0BV6ACXX:4:1108:15472:66215 99 1 16249 15 = 16540 391 Library0
    HWI-ST0764:99:C0BV6ACXX:4:1108:3056:153621 1123 1 16249 15 = 16558 391 Library0
    ---------------------------------------------
    1 16350 16419 69 3 15.3084 >Deletion_xxx_00000001<

    HWI-ST0764:99:C0BV6ACXX:4:2302:16721:121399 83 1 69682 12 = 69383 -399 Library0
    HWI-ST0764:99:C0BV6ACXX:4:2204:19244:40995 83 1 69785 36 = 69523 -362 Library0
    HWI-ST0764:99:C0BV6ACXX:4:1101:7617:39485 83 1 69797 29 = 69536 -361 Library0
    ---------------------------------------------
    1 69637 69682 45 3 16.6685 >Deletion_xxx_00000002<

    HWI-ST0764:99:C0BV6ACXX:4:1204:14771:27644 99 1 367948 0 = 368253 369 Library0
    HWI-ST0764:99:C0BV6ACXX:4:2103:1214:124930 83 1 368340 0 = 368023 -417 Library0
    ---------------------------------------------
    1 368124 368253 129 2 -0 >Deletion_xxx_00000003<

    HWI-ST0764:99:C0BV6ACXX:4:2306:18464:168765 83 1 802031 57 = 801722 -403 Library0
    HWI-ST0764:99:C0BV6ACXX:4:2202:17216:184485 99 1 801733 37 = 802023 369 Library0
    HWI-ST0764:99:C0BV6ACXX:4:1102:11251:109896 83 1 802054 57 = 801737 -408 Library0
    HWI-ST0764:99:C0BV6ACXX:4:2101:20094:111155 83 1 802052 57 = 801755 -397 Library0
    HWI-ST0764:99:C0BV6ACXX:4:2304:14851:200592 83 1 802033 60 = 801771 -362 Library0
    HWI-ST0764:99:C0BV6ACXX:4:2204:16036:62667 99 1 801789 37 = 802080 372 Library0
    HWI-ST0764:99:C0BV6ACXX:4:1307:14444:68097 99 1 801800 57 = 802117 403 Library0
    HWI-ST0764:99:C0BV6ACXX:4:2206:4525:22206 83 1 802136 0 = 801822 -399 Library0
    HWI-ST0764:99:C0BV6ACXX:4:2106:3993:7815 83 1 802110 57 = 801830 -379 Library0
    HWI-ST0764:99:C0BV6ACXX:4:1204:5671:93720 1107 1 802121 57 = 801830 -379 Library0
    HWI-ST0764:99:C0BV6ACXX:4:1205:12390:55233 99 1 801835 37 = 802137 386 Library0
    HWI-ST0764:99:C0BV6ACXX:4:2103:16357:92085 83 1 802136 7 = 801839 -390 Library0
    HWI-ST0764:99:C0BV6ACXX:4:2306:16690:178455 83 1 802141 7 = 801847 -374 Library0
    HWI-ST0764:99:C0BV6ACXX:4:2304:8284:19653 99 1 801852 37 = 802140 381 Library0
    HWI-ST0764:99:C0BV6ACXX:4:2304:18678:164778 99 1 801853 37 = 802136 376 Library0
    HWI-ST0764:99:C0BV6ACXX:4:2106:6319:57635 83 1 802150 5 = 801859 -387 Library0
    HWI-ST0764:99:C0BV6ACXX:4:2304:5415:115448 99 1 801860 37 = 802143 382 Library0
    ---------------------------------------------
    1 801961 802023 62 17 9.95808 >Deletion_xxx_00000004<
  • mastal
    Senior Member
    • Mar 2009
    • 666

    #2
    Extracting specific lines/rows with awk

    How many different patterns/lines are you trying to extract?

    Grep will also work:
    $grep 'pattern' in.txt > out.txt

    check
    $grep --help

    for the different options you can use with grep.

    Comment

    • rhinoceros
      Senior Member
      • Apr 2013
      • 372

      #3
      You mean you need to extract lines that begin with '1'? If so,

      grep '^1' file.txt > out.txt
      savetherhino.org

      Comment

      Latest Articles

      Collapse

      • GATTACAT
        Reply to Nine Things a Sample Prep Scientist Thinks About Before Sequencing
        by GATTACAT
        Love this - good data definitely starts from good input, and poor input can only give relatively poor data. I particularly like the mention of Nanodrop/absorbance based methods for quantification. It's such a toss up if you'll get an accurate reading or what amounts to a randomly generated number, and a lot of library/sequencing related issues can be traced back to poor quant.
        07-01-2026, 11:43 AM
      • SEQadmin2
        Nine Things a Sample Prep Scientist Thinks About Before Sequencing
        by SEQadmin2


        I’m not a sequencing expert. I’m a purification scientist who uses NGS to evaluate workflows my group develops. With this perspective, we think about the sample first and the NGS workflow second. The sequencer is an exceptionally honest reporter, but it can only report on what you give it, so whether you get clean, interpretable data from an NGS workflow is largely determined before you begin.

        Here are nine questions we think about, in roughly the order they matter, before...
        06-18-2026, 07:11 AM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by SEQadmin2, Yesterday, 11:08 AM
      0 responses
      6 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 06-30-2026, 05:37 AM
      0 responses
      11 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 06-26-2026, 11:10 AM
      0 responses
      19 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 06-17-2026, 06:09 AM
      0 responses
      53 views
      0 reactions
      Last Post SEQadmin2  
      Working...