Sponsored Content
Top Forums Shell Programming and Scripting How to make AWK process an input file many many times? Post 302421314 by zaxxon on Friday 14th of May 2010 04:49:31 AM
Old 05-14-2010
Still somewhat abstract - to answer abstract you can just fill 1 array with your matching pattern lines and another array with all lines. In the END block you can walk through both arrays onto each other by as many elements that are in the 1st array.

An example input file with an example of expected output would help to help.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to make my command work at all times

hi all, This is a very basic question. I want to make the command work at all times. i'm working on Suse-Linux and "clear" command is used to clear the contents of screen. I want to use only "cls" instead of "clear" command. i tried alias cls=clear , but its working only for a temporary... (3 Replies)
Discussion started by: wxwidgets
3 Replies

2. Shell Programming and Scripting

how to start a process and make it sleep for 5 mins and then kill that process

how to start a process and make it sleep for 5 mins and then kill that process (6 Replies)
Discussion started by: shrao
6 Replies

3. Shell Programming and Scripting

Can process substitution be used as an input file to another program?

Hey, I was trying to figure out how to launch a program from the command line, and it works if you pass it a config file. I was thinking about writing a script to dynamically create the config file and pass it to the command using something like command substitution (so I don't actually have to... (3 Replies)
Discussion started by: bj0
3 Replies

4. UNIX for Dummies Questions & Answers

make 1 new file using records of 5 input files

can you make me an awk script that will: read the 1st record from each input file, file1 file2 file3 file4 and file5 and write them to file6. then..... read the 2nd record from each input file, file1 file2 file3 file4 and file5 and append them to file6. then..... read the 3rd record... (1 Reply)
Discussion started by: kenneth.mcbride
1 Replies

5. Shell Programming and Scripting

How to make the parent process to wait for the child process

Hi All, I have two ksh script. 1st script calls the 2nd script and the second script calls an 'C' program. I want 1st script to wait until the 'C' program completes. I cant able to get the process id for the 'C' program (child process) to make the 1st script to wait for the second... (7 Replies)
Discussion started by: sennidurai
7 Replies

6. Shell Programming and Scripting

How to read the input from a file in background process?

Hi I have a script to run some other scripts automatically. But while running the script it should take the input value from a text file instead of taking from the keyboard. Please find last two lines of the script below. Here ans should be taken from a text file ineerly without displaying this... (1 Reply)
Discussion started by: shirdi
1 Replies

7. Shell Programming and Scripting

Reading a file several times with awk

Hi everyone, I was wondering if it's possible to read a file ("file2" in my example) more than once. In this example I want to print file2 entirely for each lines of file1: awk -F$'\t' '{ print $0 while ((getline < "file2") > 0) { print "\t"$0 } }' file1 It... (4 Replies)
Discussion started by: anthony.cros
4 Replies

8. Shell Programming and Scripting

The scripts not able to make the file to size 0, every times it go back to its original size

#!/bin/sh ########################################################################################################## #This script is being used for AOK application for cleaning up the .out files and zip it under logs directory. # IBM # Created #For pdocap201/pdoca202 .out files for AOK #1.... (0 Replies)
Discussion started by: mridul10_crj
0 Replies

9. Shell Programming and Scripting

make loop from input file

Hi Guys, I have file A.txt PP97 PP66 PP87 PP66 PP47 PP57 PP44 PP20 PP66 PP16 PP13 PP51 PP68 PP70 PP75 PP30 (2 Replies)
Discussion started by: asavaliya
2 Replies

10. Shell Programming and Scripting

How to check same process running 10 times?

At run time Without knowing job name how to check the job running in specific user "ABCD" ,If the running job duplicate more then 10 then script it self send alert message to the users with the process ID name so that will kill the processed to avoid hung issue ,tried below script please check and... (15 Replies)
Discussion started by: Kalia
15 Replies
array(n)						       Tcl Built-In Commands							  array(n)

__________________________________________________________________________________________________________________________________________________

NAME
array - Manipulate array variables SYNOPSIS
array option arrayName ?arg arg ...? _________________________________________________________________ DESCRIPTION
This command performs one of several operations on the variable given by arrayName. Unless otherwise specified for individual commands below, arrayName must be the name of an existing array variable. The option argument determines what action is carried out by the command. The legal options (which may be abbreviated) are: array anymore arrayName searchId Returns 1 if there are any more elements left to be processed in an array search, 0 if all elements have already been returned. SearchId indicates which search on arrayName to check, and must have been the return value from a previous invocation of array startsearch. This option is particularly useful if an array has an element with an empty name, since the return value from array nextelement won't indicate whether the search has been completed. array donesearch arrayName searchId This command terminates an array search and destroys all the state associated with that search. SearchId indicates which search on arrayName to destroy, and must have been the return value from a previous invocation of array startsearch. Returns an empty string. array exists arrayName Returns 1 if arrayName is an array variable, 0 if there is no variable by that name or if it is a scalar variable. array get arrayName ?pattern? Returns a list containing pairs of elements. The first element in each pair is the name of an element in arrayName and the second element of each pair is the value of the array element. The order of the pairs is undefined. If pattern is not specified, then all of the elements of the array are included in the result. If pattern is specified, then only those elements whose names match pat- tern (using the matching rules of string match) are included. If arrayName isn't the name of an array variable, or if the array contains no elements, then an empty list is returned. array names arrayName ?pattern? Returns a list containing the names of all of the elements in the array that match pattern (using the matching rules of string match). If pattern is omitted then the command returns all of the element names in the array. If there are no (matching) elements in the array, or if arrayName isn't the name of an array variable, then an empty string is returned. array nextelement arrayName searchId Returns the name of the next element in arrayName, or an empty string if all elements of arrayName have already been returned in this search. The searchId argument identifies the search, and must have been the return value of an array startsearch command. Warning: if elements are added to or deleted from the array, then all searches are automatically terminated just as if array done- search had been invoked; this will cause array nextelement operations to fail for those searches. array set arrayName list Sets the values of one or more elements in arrayName. list must have a form like that returned by array get, consisting of an even number of elements. Each odd-numbered element in list is treated as an element name within arrayName, and the following element in list is used as a new value for that array element. If the variable arrayName does not already exist and list is empty, arrayName is created with an empty array value. array size arrayName Returns a decimal string giving the number of elements in the array. If arrayName isn't the name of an array then 0 is returned. array startsearch arrayName This command initializes an element-by-element search through the array given by arrayName, such that invocations of the array nex- telement command will return the names of the individual elements in the array. When the search has been completed, the array done- search command should be invoked. The return value is a search identifier that must be used in array nextelement and array done- search commands; it allows multiple searches to be underway simultaneously for the same array. | array unset arrayName ?pattern? | Unsets all of the elements in the array that match pattern (using the matching rules of string match). If arrayName isn't the name | of an array variable or there are no matching elements in the array, then an empty string is returned. If pattern is omitted and is | it an array variable, then the command unsets the entire array. KEYWORDS
array, element names, search Tcl 8.3 array(n)
All times are GMT -4. The time now is 12:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy