![]() |
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 |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Data manipulation/ formatting question | ddurden7 | UNIX for Dummies Questions & Answers | 2 | 04-12-2009 07:42 PM |
| Data manipulation in perl | chriss_58 | Shell Programming and Scripting | 1 | 06-13-2008 01:56 PM |
| data manipulation script | grinder182533 | UNIX for Dummies Questions & Answers | 1 | 11-10-2006 02:48 PM |
| More log manipulation | StevePace | Shell Programming and Scripting | 8 | 02-13-2006 03:20 AM |
| Help with log manipulation | StevePace | Shell Programming and Scripting | 3 | 01-31-2006 08:28 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Data manipulation with Awk
Hello guys,
I'm a new member here and I need some help with the Awk application. I'm using it through the Terminal app of OSX (I'm a Mac user). I have a huge file with a large amount of data (rows of 3D cartesian coordinates). The data is typically like the following example (actually, the data is made of several thousands of "curves" defined by a list of points in 3D) : Quote:
Quote:
How can I do that ? Someone has an idea ? ![]() ![]() The only data manipulation I know to do with Awk is like this example : Quote:
|
|
||||
|
Code:
awk '/End of/{
if(flag==0){
flag=1
print "NumberOfLines"NR
for(i=1;i<=NR;i++){
printf i-1" "
}
pre=NR
}
else{
num=NR-pre
print "NumberOfLines"num
for(i=pre+1;i<=NR;i++){
printf i-1" "
}
pre=NR
}
print ""
}'
|
|
||||
|
Quote:
Code:
expr ? action1 : action2 Code:
s=n?s " " c++:c++ Explanation: if n != 0 then s = s " " c++ else s = c++ Last edited by Franklin52; 08-24-2009 at 03:21 PM.. Reason: Correction of explanation: if n != 0 instead of if n = 0 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|