Unconfigured Ad

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

    #1

    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

      • SEQadmin2
        Beyond CRISPR/Cas9: Understand, Choose, and Use the Right Genome Editing Tool
        by SEQadmin2



        CRISPR/Cas9 sparked the gene editing revolution for both research and therapeutics.1 But this system still showed severe issues that limited its applications. The most prominent were the heavy reliance on PAM sequences, delivery limitations, double-stranded breaks that prompt unintended edits and cell death, and editing inefficiency (both in targeting and in knock-in reliability).

        Despite this, “CRISPR helped turn genome editing from a specialized technique into
        ...
        07-31-2026, 11:01 AM
      • SEQadmin2
        Proteomic Platforms: How to Choose the Right Analytical Strategy to Improve Detection and Clinical Applications
        by SEQadmin2


        Proteomics platforms are evolving rapidly, with advances in mass spectrometry and affinity-based approaches expanding what researchers can detect and at what scale. As the field moves toward deeper proteome coverage and clinical applications, scientists face an increasingly complex landscape of tools. This article will explore how researchers are navigating these choices to find the right platform for their work.

        The systematic characterization of the human proteome has
        ...
        07-20-2026, 11:48 AM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by SEQadmin2, 08-13-2026, 12:22 PM
      0 responses
      25 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 08-11-2026, 10:35 AM
      0 responses
      21 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 08-06-2026, 07:41 AM
      0 responses
      36 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 08-03-2026, 10:13 AM
      0 responses
      51 views
      0 reactions
      Last Post SEQadmin2  
      Working...