Suppose you want to do something like this: cat file1 | gawk -f script.awk file2 file3 file4 How do you handle this? gawk (GNU Awk 3.1.1) seems to skip over...
... Some UNIX/LINUX utilities allow you to include "-" by itself among a list of filenames on the command line as an indication to read the standard input ...
See GNU project on Sourceforge.net ... From: goodmis To: geeksthatgawk@yahoogroups.com Sent: Tuesday, April 27, 2004 11:33 PM Subject: [Geeks that Gawk] Need...
Thanks William, I downloaded UnDows and it was just what I needed. I have to admit I am a little rusty on my French. Thanks Again Jason Give me (G)awk and I...
It's a pleasure Jason Did you get what you wanted ? The real gawk is on the GNU list http://sourceforge.net/project/showfiles.php?group_id=23617 with all the...
I am running UnDows and I would like to use a switch statement. Is this possible? switch ($1) { case 1: printf("%s\n", $1) case 2: printf("%s\n", $2) } ...
I don't think there is a switch statement in (g)awk. In this situation, I've always used the following construct: if ( ) { } else if ( ) { } else { } --Albert...
Thanks Albert, I saw something about a switch in some gawk documentation. NOTE: This subsection describes an experimental feature added in gawk 3.1.3. It is...
I have to agree with the earlier post. switch(. <var> ){ case <const> ... } Is a terse version of if-else if-else if phrasing. From gawk 3.1 User Manual: ...
Is there a way that I can implement Interactive Commands? Instead doing this by hand. Enter Name: Jason <return> Do you want to continue? Y <return> Can I put...
Hello, Have several shell scripts, that issue sed and awk commands that have worked will for years on SCO Unix. We are moving our application to a new Redhat...
... have ... to ... Hello Again, Found that shell scripts and awk programs work fine. It was just the transfer process that added something to each end of...
I have a set of files that need to have a number assigned to $3 for each record, but if the record has the same value in $2, the value in $3 must stay the same...
In order to achieve what you give in your example, I would suggest this: BEGIN {FS="|"; OFS="|"; last="";} { if ($2 != last) { last = $2 line++; } $3 =line; ...
pl. help. I have large data files that separated by numeric file extensions. I need t process them in order and compile the necessary info. What is the best...
I have used gawk for similar applications. Since it processes files sequentially, it can handle very large files. The only significant limits are the speed...
... Thanks Albert! Your solution works great. I did have to change it to fit my actual file format - here are a few lines (bear with me - I'm showing the REST...
Okay, so it sounds like you've got two different counters which vary independently, which are embedded in the file names. So, one way to accomplish that would...
From what you've said below, it sounds like you've handled things more or less the way I would have done it. Perhaps there is a more elegant way, but one of...
... The reason I was trying to do it in one script, was for speed - I'm processing about 1 million records each time I run it, and doing quite a few other...
... few ... I'm afraid I don't know that. You might have to do some testing to find out. I was speaking before from the perspective of optimizing development...
With help of someone, for my immediate need, I was able to do the following and was able to process the files. #! /bin/bash for ( j = 1; j < 125; j++ ); do ...
Greetings, I have about 1.5 million records that need to be updated, based on the value in the 1st field (pipe delimited). Loading the records into a database...
Hi gawk gurus, I have an input file that is only one great line, with no field separator. The fields have fixed width. (files from mainframe). for example, an...
... A combination of sed and awk can make this work fairly easily (I'm working on a bash shell, so you may need to tweak this if you use Windows: $ sed...
I noticed the set of sed & awk commands got broken into 1 too many lines. All of this belongs on one line: sed 's/\(.\{14\}\)/\1|/g;s/|/|\n/g' source_file|sed ...
Thanks Don thats a solution! But think about large files (around 3 GB). Thats would be resource intensive, and I would spent disk space, since the original...