04-01-2009
hi
Thanks for your help. I've made the modifications but still does not work:
code:
[#!/bin/sh
set -x
for shell_args in "$@"
do
stype=` awk '{print substr ("'"$shell_args"'", 0, 3)}' `
echo $stype
done
]
**************************
debug:
[sh mytest.sh es_GELitems1 ab_s1_Abools1 ai_s1_Aints1 as_s1_Astrings1 at_s1_Atests1 ee_ ei_s1_Eints
+ for shell_args in '"$@"'
++ awk '{print substr ("es_GELitems1", 0, 3)}'
]
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi folks,
I am wondering how to output awk back to a variable.
I am new to Unix/Linux.
I am trying to get rid of a decimal number and put the output back in a variable for further use in the script. here is how I used awk:
var=$1
echo $var |awk '{print $1 *100}' | $var
echo $var
this... (4 Replies)
Discussion started by: bashirpopal
4 Replies
2. UNIX for Dummies Questions & Answers
I have a file which I am processing using awk to spit out the following:
export CLIENT=1 ; export USER=1 ; export METABASE=1 ; export TASK=1 ; export TOTAL=3
What i want to do now is execute that within the script so those variables are available to other commands. I've tried piping the... (3 Replies)
Discussion started by: Cranie
3 Replies
3. Shell Programming and Scripting
Hi
I am trying to store the output of awk into a variable in a shell script. I can run it successfully from the command line but not from a ksh shell script.
ls -al test.txt | grep -v grep | awk '{print $1}'
returns -rw-r--r--
#!/bin/ksh
perm=$(`ls -al test.txt | grep -v grep | awk... (2 Replies)
Discussion started by: mace_560
2 Replies
4. Shell Programming and Scripting
Hi all,
Hope someone can help me out here.
I have this BASH script (see below)
My problem lies with the variable path.
The output of the command find will give me several fields. The 9th field is the path. I want to captured that and the I want to filter this to a specific level.
The... (6 Replies)
Discussion started by: Cowardly
6 Replies
5. 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
6. Shell Programming and Scripting
I have a script whose contents are as below
result= awk 's=100 END {print s }'
echo "The result is" $result
The desired output is
The result is 100
My script is running without exiting and i am also not getting the desired output.
Please help (5 Replies)
Discussion started by: bk_12345
5 Replies
7. Shell Programming and Scripting
Hi Experts,
I am trying to get system output to capture inside awk , but not working:
Please advise if this is possible :
I am trying something like this but not working, the output is coming wrong:
echo "" | awk '{d=system ("date") ; print "Current date is:" , d }'
Thanks, (5 Replies)
Discussion started by: rveri
5 Replies
8. Shell Programming and Scripting
I am reading an xml file with date tag as <Date>Default</Date> using the below command.
Dt=$(awk -F'' '/<Date>/{print $3}' /home/test/try.xml
and getting the value from the xml file stored in this variable "Dt"
echo $Dt gives me a value. Dt=Default.
Now according to my requirement, If... (2 Replies)
Discussion started by: Saidul
2 Replies
9. Shell Programming and Scripting
Stumped with the formatting of the awk output when used with variables, e.g.:
awk -F, 'BEGIN {OFS=","} print {$2,$3,$4}' $infile1
produces the desired output (with rows), but when echoing the variable below, the output is one continuous line
var1=$(awk -F, 'BEGIN {OFS=","} print... (4 Replies)
Discussion started by: ux4me
4 Replies
10. UNIX for Beginners Questions & Answers
Hi,
I am trying to use variable output in awk to append a string to a word in a line. But that is not happening. Could you please help me on this.
YouTube Video Tutorial: How to Use Code Tags and Format Posts @UNIX.com
The below is the code
#!/bin/ksh
set -x
src=/users/oracle/Temp... (2 Replies)
Discussion started by: pvmanikandan
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)