Results 1 to 4 of 4
hi can any one help me out..
my row.txt file contains like this...i want to get the first field of row1 row2 and so on..
[Row] 1
1 2.940769361E-009
2 ...
- 01-02-2009 #1Just Joined!
- Join Date
- Jan 2009
- Posts
- 12
pattern match
hi can any one help me out..
my row.txt file contains like this...i want to get the first field of row1 row2 and so on..
[Row] 1
1 2.940769361E-009
2 2.430446475E-011
3 2.476075468E-011
[Row] 2
2 1.327840827E-009
3 4.387348541E-010
4 1.161288314E-010
5 1.7906279E-010
6 1.231085385E-010
[Row] 3
3 1.07825276E-009
4 1.219313865E-010
5 1.151911893E-010
expected output:
1 2.940769361E-009
2 1.327840827E-009
3 1.07825276E-009
need urgently and the o/p to be directed to a new file
- 01-02-2009 #2The redirection is easyCode:
awk '_&&_--;/^\[/{_=1}' infile
- 01-02-2009 #3Just Joined!
- Join Date
- Jan 2009
- Posts
- 12
thnx
hey thnx a lot...
but can u please explain me the code,so that next time i can do it of my own..
- 01-02-2009 #4If the current record matches the the pattern - [ at the beginning of the string - assign the value 1 (i.e. true in boolean context) to the variable _.Code:
/^\[/{_=1}
Decrement the _ variable while it returns true evaluated in boolean context triggering the default action (which is print the current record).Code:_&&_--


Reply With Quote