Problem with awk array when loading from shell variable
Hi, I have a problem with awk array when iam trying to use awk in solaris box as below..Iam unable to figure out the problem..
Need your help. is there any alternative to make it in arrays from variable values
Hi Jotne,Thanks for the info..will use code tags from here on.What iam trying to achieve is..I have the below blocks of data which i want to find the max Job-id and start printing only the blocks and omitting the rest
My logic goes in this way
> find the pattern [0-9]{4,} [A-Z][a-z]{2,} [0-9]{2,} i.,e 2013 Jan 23 09
and get the job-id and line number of the file
> Take it in a variable and find the max jobid in the file.
> Now traverse the jobid in the same variable and find the startpt and the endpt.
> send this to the basic awk command
awk 'NR==STPT,NR=={ENDPT}-1' and print only the blocks.
Here i got struck at the last point when i try to split the values through " ",take it in an array and send as startpoint and endpoint.
Need your help. I/p ---------- Post updated at 07:16 AM ---------- Previous update was at 07:07 AM ----------
Sorry i didnt mention the o/p..The expected o/p should be the blocks with Job-107544.
o/p
Last edited by cskumar; 06-19-2013 at 02:23 AM..
Reason: Please use code tags only for code, not just the whole text. Thats not what they are for.
You are using code tags wrong. I am not able to read this.
Mark group of text, not all and select co-de button.
And you can use edit button to edit your post.
Hello All,
Can you please help me with the below.
#!/bin/bash
ARR="No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5 EXTRACT_DT:30-SEP-12 VER_NUM:1"
ARR="No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5... (14 Replies)
Hi, all
suppose I have following myfile (delimited by tab)
aa bb
cc dd
ee ffand I have following awk command:
awk 'BEGIN{FS="\t"}{AwkArrayVar_1=$1;AwkArrayVar_2=$2};END{for(i=0; i<NR; i++) print i, AwkArrayVar_1, AwkArrayVar_2,}' myfileMy question is: how can I assign the awk array... (7 Replies)
Hello experts,
I'm stuck with this script for three days now. Here's what i need.
I need to split a large delimited (,) file into 2 files based on the value present in the last field.
Samp: Something.csv
bca,adc,asdf,123,12C
bca,adc,asdf,123,13C
def,adc,asdf,123,12A
I need this split... (6 Replies)
Hi friends,
I'm having a bit of a problem using shell variable in an awk if statement.
Please note that i'm using -v option as listed in many forums but I still don't get it working. Here's my code. Kindly help as I've gone crazy trying to work this out :wall:
#!/bin/bash -xv
... (4 Replies)
i have an array call ignore. it is set up
ignore=34th56
ignore=re45ty
ignore=rt45yu
.
.
ignore=rthg34
n is a variable. I have another variable that i read from a different file. It is $2 and it is working the way i expect. array ignore read and print correct values.
in the below if... (2 Replies)
Hi all,
i have a data array as follows.
array=ertfgj2345
array=456ttygkd
.
.
.
array=errdjt3235
so number or elements in the array can varies depending on how big the data input is.
now i have a variable, and it is $1 (there are $2, $3 and so on, i am only interested in $1).
... (9 Replies)
hi all i am trying to save an awk value into an array in bash:
total=`awk '{sum+=$3} END {print sum}' "$count".txt"`
((count++))
the above statement is in a while loop..
$count is to keep track of file numbers (1.txt,2.txt,3.txt,etc.)
i get the following error:
./lines1:... (1 Reply)
Like class loader in java, can we make a function loader in shell script, for this can someone throw some light on how internally bash runs a shell script , what happenes in runtime ...
thanks in advance.. (1 Reply)
Hi,
I made a small awk program just to test array variables.
I couldn't find anything wrong with it.
But it doesn't give out valid numbers.( just 0.00 )
Do you see any problem that I didn't see?
Thanks in advance!
Here is the program:
##################################
BEGIN {
FS =... (4 Replies)