Sponsored Content
Full Discussion: delete lines
Top Forums Shell Programming and Scripting delete lines Post 302360441 by su_in99 on Friday 9th of October 2009 01:51:40 AM
Old 10-09-2009
delete lines

Hello,

I've got some huge text files look like below. I've cut a couple blocks from about 67000 blocks in the file. Basically, I would like to pick up the second line of each blocks.

Code:
Grid-ref=   1, 148
 3020 2820 3040 2880 1740 1360  980  990 1410 1770 2580 2630
 3020 2820 3040 2880 1740 1360  980  990 1410 1770 2580 2630
 3020 2820 3040 2880 1740 1360  980  990 1410 1770 2580 2630
 3020 2820 3040 2880 1740 1360  980  990 1410 1770 2580 2630
 3020 2820 3040 2880 1740 1360  980  990 1410 1770 2580 2630
 3020 2820 3040 2880 1740 1360  980  990 1410 1770 2580 2630
 3020 2820 3040 2880 1740 1360  980  990 1410 1770 2580 2630
 3020 2820 3040 2880 1740 1360  980  990 1410 1770 2580 2630
 3020 2820 3040 2880 1740 1360  980  990 1410 1770 2580 2630
 3020 2820 3040 2880 1740 1360  980  990 1410 1770 2580 2630
Grid-ref= 217, 158
 2464 6009 2357 1759  559  824  377  699 1598 2311 2987 3650
 4582 2779 2745 1286 1131  409 1834 2733  961 1305 1798 2571
 4565 3847 2958 3990 2599  266 2266 1725 1317 4604 3376 4089
 3458 4595 4535 2314  792 2538  370 3592  935 2429 1630 2962
 3424 2822 2514 2949 4174  574  423  408 2530 2150 2388 4767
 3729 2396 3915 1863 2792 2427  474  722 1312 1834 1752 2727
 2245 3784 1928 2271 1559  312 1663  243 1539 3064 2498 3418
 3804 2205 4010 2058 2049  170 1404  310  815 1052 2513 3572
 2666 3392 3362 2314 1235   50  623  901  662  996 2572 2237
 3846 3217 3436  865 1044  119 1411  324  889 3580 1558 1954
Grid-ref= 217, 159
 2381 6044 2359 1681  627  777  455  686 1879 2053 3169 3460
 4170 3020 2930 1225 1221  615 1711 2395 1002 1544 1743 2356
 4109 3818 2871 3886 2254  399 1921 1465 1350 4562 3348 3463
 3485 4433 4474 2537  734 2134  380 3049 1035 2363 1443 2728
 3390 2443 2692 2780 3465  524  427  470 2307 1838 2502 4413
 3762 2320 3775 1745 2355 1948  426  688 1165 1924 1726 2680
 2012 3714 1859 2123 1445  370 1456  290 1404 2762 2446 3052
 3546 1969 4162 1977 1772  147 1403  249  833 1224 2308 3447
 2518 3071 3284 2243 1160   36  506  811  627  949 2386 2247
 3928 2964 3049  807 1030  131 1259  366  958 3300 1331 1939

So after manipulating the file, it seems to be like this.

Code:
Grid-ref=   1, 148
 3020 2820 3040 2880 1740 1360  980  990 1410 1770 2580 2630
Grid-ref= 217, 158
 4582 2779 2745 1286 1131  409 1834 2733  961 1305 1798 2571
Grid-ref= 217, 159
 4170 3020 2930 1225 1221  615 1711 2395 1002 1544 1743 2356

I've no clue how to work with a huge text file like this and Excel over Window definitely doesn't work.

Any idea would be much appreciate.

Best wishes,

Last edited by Franklin52; 10-09-2009 at 03:55 AM.. Reason: Please use code tags!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to delete first 5 lines and last five lines in all text files

Hi I want to delete first five and last five lines in text files without opening the file and also i want to keep the same file name for all the files. Thanks in advance!!! Ragav (10 Replies)
Discussion started by: ragavendran31
10 Replies

2. Shell Programming and Scripting

Grep and delete lines except the lines with strings

Hi I am writing a script which should read a file and search for certain strings 'approved' or 'removed' and retain only those lines that contain the above strings. Ex: file name 'test' test: approved package waiting for approval package disapproved package removed package approved... (14 Replies)
Discussion started by: vj8436
14 Replies

3. Shell Programming and Scripting

How to delete lines in a file that have duplicates or derive the lines that aper once

Input: a b b c d d I need: a c I know how to get this (the lines that have duplicates) : b d sort file | uniq -d But i need opossite of this. I have searched the forum and other places as well, but have found solution for everything except this variant of the problem. (3 Replies)
Discussion started by: necroman08
3 Replies

4. Shell Programming and Scripting

sed problem - delete all lines until a match on 2 lines

First of all, I know this can be more eassily done with perl or other scripting languages but, that's not the issue. I need this in sed. (or wander if it's possible ) I got a file (trace file to recreate the control file from oracle for the dba boys) which contains some lines another line... (11 Replies)
Discussion started by: plelie2
11 Replies

5. UNIX for Dummies Questions & Answers

How get only required lines & delete the rest of the lines in file

Hiiii I have a file which contains huge data as a.dat: PDE 1990 1 9 18 51 28.90 24.7500 95.2800 118.0 6.1 0.0 BURMA event name: 010990D time shift: 7.3000 half duration: 5.0000 latitude: 24.4200 longitude: 94.9500 depth: 129.6000 Mrr: ... (7 Replies)
Discussion started by: reva
7 Replies

6. Shell Programming and Scripting

need to delete all lines from a group of files except the 1st 2 lines

Hello, I have a group of text files with many lines in each file. I need to delete all the lines in each and only leave 2 lines in each file. (3 Replies)
Discussion started by: script_op2a
3 Replies

7. UNIX for Advanced & Expert Users

In a huge file, Delete duplicate lines leaving unique lines

Hi All, I have a very huge file (4GB) which has duplicate lines. I want to delete duplicate lines leaving unique lines. Sort, uniq, awk '!x++' are not working as its running out of buffer space. I dont know if this works : I want to read each line of the File in a For Loop, and want to... (16 Replies)
Discussion started by: krishnix
16 Replies

8. Shell Programming and Scripting

search and replace, when found, delete multiple lines, add new set of lines?

hey guys, I tried searching but most 'search and replace' questions are related to one liners. Say I have a file to be replaced that has the following: $ cat testing.txt TESTING AAA BBB CCC DDD EEE FFF GGG HHH ENDTESTING This is the input file: (3 Replies)
Discussion started by: DeuceLee
3 Replies

9. Shell Programming and Scripting

Sed/awk to delete single lines that aren't touching other lines

Hello, I'm trying to figure out how to use sed or awk to delete single lines in a file. By single, I mean lines that are not touching any other lines (just one line with white space above and below). Example: one two three four five six seven eight I want it to look like: (6 Replies)
Discussion started by: slimjbe
6 Replies

10. UNIX for Beginners Questions & Answers

Delete multiple lines between blank lines containing two patterns

Hi all, I'm looking for a way (sed or awk) to delete multiple lines between blank lines containing two patterns ex: user: alpha parameter_1 = 15 parameter_2 = 1 parameter_3 = 0 user: alpha parameter_1 = 15 parameter_2 = 1 parameter_3 = 0 user: alpha parameter_1 = 16... (3 Replies)
Discussion started by: ce9888
3 Replies
PCCBB(4)						   BSD Kernel Interfaces Manual 						  PCCBB(4)

NAME
pccbb -- cardbus bridge driver SYNOPSIS
device cbb device pccard device cardbus device exca DESCRIPTION
The pccbb driver implements the Yenta specification for CardBus bridges. The following PCI cardbus and pcmcia bridges are supported: Cirrus Logic PD6832 Cirrus Logic PD6833 Cirrus Logic PD6834 O2micro OZ6812 O2micro OZ6832 O2micro OZ6833 O2micro OZ6836 O2micro OZ6860 O2micro OZ6872 O2micro OZ6912 O2micro OZ6922 O2micro OZ6933 O2micro OZ6972 O2Micro OZ711E1 O2Micro OZ711M1 Ricoh RL4C475 Ricoh RL4C476 Ricoh RL4C477 Ricoh RL4C478 TI PCI-1031 TI PCI-1130 TI PCI-1131 TI PCI-1210 TI PCI-1211 TI PCI-1220 TI PCI-1221 TI PCI-1225 TI PCI-1250 TI PCI-1251 TI PCI-1251B TI PCI-1260 TI PCI-1260B TI PCI-1410 TI PCI-1420 TI PCI-1450 TI PCI-1451 TI PCI-1510 TI PCI-1515 TI PCI-1520 TI PCI-1530 TI PCI-1620 TI PCI-4410 TI PCI-4450 TI PCI-4451 TI PCI-4510 TI PCI-4520 TI PCI-[67]x[12]1 TI PCI-[67]x20 ENE CB710 ENE CB720 ENE CB1211 ENE CB1255 ENE CB1410 ENE CB1420 Toshiba ToPIC95 Toshiba ToPIC95B Toshiba ToPIC97 Toshiba ToPIC100 TUNABLES
The driver supports the following tunable parameters, which may be added to /boot/loader.conf or set via the sysctl(8) command: hw.cbb.debug Non-zero values cause more verbose information to be printed to aid in debugging problems with the bridge chipset. SEE ALSO
cardbus(4), pccard(4), exca(4) BSD
July 21, 2004 BSD
All times are GMT -4. The time now is 02:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy