![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [C++] File I/O (Reading from a Random-Access File) | VersEtreOuNe | High Level Programming | 0 | 02-12-2008 04:34 PM |
| reading from a file and pass as variables and ignore # in the file | konark | Shell Programming and Scripting | 4 | 11-08-2007 03:55 AM |
| Reading a file and writing the file name to a param file. | thebeginer | UNIX for Advanced & Expert Users | 1 | 10-05-2007 04:38 PM |
| Reading file names from a file and executing the relative file from shell script | anushilrai | Shell Programming and Scripting | 4 | 03-10-2006 05:25 AM |
| Reading specific contents from a file and appending it to another file | dnicky | Shell Programming and Scripting | 5 | 10-04-2005 05:45 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
||||
|
reading file
Hi
I ‘m trying to write a simple script that will be able to extract some useful info from a file of this format: + 1.84375 0 2 cbr 210 ------- 0 0.0 3.1 225 610 - 1.84375 0 2 cbr 210 ------- 0 0.0 3.1 225 610 r 1.84471 2 1 cbr 210 ------- 1 3.0 1.0 195 600 r 1.84566 2 0 ack 40 ------- 2 3.2 0.1 82 602 + 1.84566 0 2 tcp 1000 ------- 2 0.1 3.2 102 611 - 1.84566 0 2 tcp 1000 ------- 2 0.1 3.2 102 611 r 1.84609 0 2 cbr 210 ------- 0 0.0 3.1 225 610 + 1.84609 2 3 cbr 210 ------- 0 0.0 3.1 225 610 d 1.84609 2 3 cbr 210 ------- 0 0.0 3.1 225 610 - 1.8461 2 3 cbr 210 ------- 0 0.0 3.1 192 511 r 1.84612 3 2 cbr 210 ------- 1 3.0 1.0 196 603 + 1.84612 2 1 cbr 210 ------- 1 3.0 1.0 196 603 - 1.84612 2 1 cbr 210 ------- 1 3.0 1.0 196 603 + 1.84625 3 2 cbr 210 ------- 1 3.0 1.0 199 612 For example I want to extract the information in column 18-22 but say only the number values (not necessarily all at once). Using cut utility (i.e. cut –d 18-22 filename) I get 210 210 210 40 - 1000 1000 210 210 210 210 210 210 210 210 But I only need the value without the - character In other word for each line I need the field value and I cant use [ cut –f ] because there only separated by spaces. Any ideas or know of a good Unix tutorial for beginners. Thanks |
|
||||
|
Something more I need
I am new to awk.
Bhargav, how do you get those numbers stored in variable x? Because I am on track something similar to this, where I am interested in numbers in a line present at even location. And this array x need to be populated with unique values. Also, please feel free to suggest me good links to start with learning awk & sed. So far to my observation they are powerful in terms of their usage in shell script. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|