06-18-2008
Hi,
Thanks for your quick reply.
Your command actually prints the last field of first and last line, whereas what i need is the number of fields of first and last line, to be assigned to variables.
Lines are comma-separated.
The below command prints number of fields of each line of the comma-separated file:
cat QDB_20071126_002.bad | awk -F"," '{ print NF }'
6
7
7
7
2
I need to take '6' and '2' and assign it later.
Help me out on this..
Thanks in advance.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Somebody can please give a highlight on this. The problem shows only on Linux(Redhat) not any other unix flavors
:confused:
Linux :
$unset m
$m=`find . -newer rman_padev_20051206195000.out -name "*L0.rman" -exec ls -l {} \; | awk '{ s+=$5 } END{printf("%.0f", s)}'`
$echo $m
7425089536... (0 Replies)
Discussion started by: prathom
0 Replies
2. Shell Programming and Scripting
greetings all,
I am have a heck of a time trying to accomplish a very simple thing. I have an array of "shortname<spaces>id" created from a dscl output. I want to assign shortname=word1 and id=word2. I have tried
shortname=$(${textArray} | awk '{print $1}') - and get 'awk : cannot open... (3 Replies)
Discussion started by: macnetdaemon
3 Replies
3. Shell Programming and Scripting
Dear Friends,
I have a command which can result following output.
Packet is: /var/adm/yyyy/pkt6043
Intended for network : /vob/repo
I would like to retrive
pkt6043 and /vob/repo using single command.
Blue color test will be always contstant and red color text will be dynamic
... (2 Replies)
Discussion started by: baluchen
2 Replies
4. Shell Programming and Scripting
Hi Masters,
I want to assign the values of one variable to another variable.
Here the varaible name 'var' is dynamic. I know the values of V_2 and U_3, but
If the i/p of TYPE is 'U' and the NO is 3, then I want to assign the values of
U_3 to var.
How we can achieve it?
TYPE="U"... (4 Replies)
Discussion started by: ecearund
4 Replies
5. UNIX for Dummies Questions & Answers
I have a log file that has certain fields that I want to evaluate, and depending on the value in those fields, I want to put the value of a different field in that line in a particular variable that I'll use later on down the log file. Sort of like setting a switch to change what I do with a bunch... (5 Replies)
Discussion started by: pts2
5 Replies
6. Shell Programming and Scripting
hi i want to find the size of a folder and assign it to a variable and then compare if it is greater than 1 gb.
i am doin this script, but it is throwing error....
#!/bin/ksh
cd . | du -s | size = awk '{print $1}'
if size >= 112000
then
echo size high
fi
ERROR : (4 Replies)
Discussion started by: Nithz
4 Replies
7. Shell Programming and Scripting
With this script i want to print the output to a specific field-number . Can anybody help?
awk 'NR=FNR{split(FILENAME,fn,"_");nr=$2;f = $1} END{for (i=1;i<=f;i++) print i,$fn=nr}' input_5.csv input_6.csvinput_5.csv
4 135
5 185
6 85
11 30input_6.csv
1 90
3 58
4 135
7 60
8 55
10... (1 Reply)
Discussion started by: sdf
1 Replies
8. Shell Programming and Scripting
I have a file containing multiple values, some of them are pipe separated which are to be read as separate values and some of them are single value all are these need to store in variables.
I need to read this file which is an input to my script
Config.txt
file name, first path, second... (7 Replies)
Discussion started by: ketanraut
7 Replies
9. Shell Programming and Scripting
Hello,
I have files containing a large amount of values in columns, and I want to simplify the data by making the values binary, i.e. assigning 1/0 for each value above or below a certain threshold.
I am curious to know if it's possible to use awk to do this (or another way in bash). I've... (2 Replies)
Discussion started by: ksennin
2 Replies
10. Shell Programming and Scripting
Hi Gurus,
I have a script which assign awk output to shell variable. current it uses two awk command to assign value to two variables. I want to use one command to assign two values to two variables. I tried the code, but it does't work. kindly provide your suggestion.
current code... (2 Replies)
Discussion started by: green_k
2 Replies
IGAWK(1) Utility Commands IGAWK(1)
NAME
igawk - gawk with include files
SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ...
igawk [ all gawk options ] [ -- ] program-text file ...
DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1).
AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like
@include getopt.awk
in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path.
OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports.
EXAMPLES
cat << EOF > test.awk
@include getopt.awk
BEGIN {
while (getopt(ARGC, ARGV, "am:q") != -1)
...
}
EOF
igawk -f test.awk
SEE ALSO
gawk(1)
Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995.
AUTHOR
Arnold Robbins (arnold@skeeve.com).
Free Software Foundation Nov 3 1999 IGAWK(1)