10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Trying to do so
echo "111:222:333" |awk -F: '{system("export TESTO=" $2)}'But it doesn't work (2 Replies)
Discussion started by: urello
2 Replies
2. Shell Programming and Scripting
I wrote a very simple script to understand how to call user-defined functions from within awk after reading this post.
function my_func_local {
echo "In func $1"
}
export -f my_func_local
echo $1 | awk -F"/" '{for (k=1;k<=NF;k++) {
if ($k == "a" ) {
system("my_local_func $k")
}
else{... (19 Replies)
Discussion started by: sreyan32
19 Replies
3. Shell Programming and Scripting
I need to export the built in awk variables for columns so that they are available for the rest of the script. This is what I have so far:
cat /tmp/test | eval `awk '{print "export NAME="$1; print "export NAME2="$2;}'`
echo Host is "$NAME" and Host2 is "$NAME2"
When I run bash -x to... (2 Replies)
Discussion started by: newbie2010
2 Replies
4. Shell Programming and Scripting
Using ksh to call a function which has awk script embedded.
It parses a long two element list file, filled with text numbers (I want column 2, beginning no sooner than line 45, that's the only known thing) . It's unknown where to start or end the data collection, dynamic variables will be used. ... (1 Reply)
Discussion started by: highnthemnts
1 Replies
5. UNIX Desktop Questions & Answers
Hi,
I'm having trouble getting awk to read a variable with spaces in it.
Input:
vendorName="Bob's Steakhouse"
awk -F":" '$2 ~ /'$vendorName'/ {print $1}' Purchases.dat
Error:
awk: $2 ~ /Bob's
awk: ^ unterminated regexp
The awk command isn't recognizing the entire string. It... (2 Replies)
Discussion started by: Cablephish
2 Replies
6. Shell Programming and Scripting
Hi guys,
Does awk have a built-in variable which I can use to display the input file it's currently reading?
I'm currently concatenating multiple files using awk and later on do some parsing. But for now, I want to add an extra column in the main output data file - basically putting in the... (3 Replies)
Discussion started by: Det7
3 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I'm pretty new to AWK and was wondering if someone could let me know how to execute varibles within an AWK statement. An example is below:
NO=6
end=25
awk = 'NR == $NO, NR == $end' file1 > file2
I'm currently attempting to use this within a script but awk seems to read $NO and... (2 Replies)
Discussion started by: chris01010
2 Replies
8. UNIX for Advanced & Expert Users
hello everybody,
as explained in the title, here is what I want:
str1="name1 name2 name3"
str2="name1"
str3="name"
I know that match(str1,str2) will return 1, but I want that match(str1,str3) returns 0 (when it also returns 1...)
Is there a way to get that exact matching process done... (6 Replies)
Discussion started by: farphe
6 Replies
9. Shell Programming and Scripting
Hi,
I have some files in metrica (assume a pre-defined format) which i need to process and have some values in a .csv file. The script that does this, part of which is:
procMetricaOMData()
{
host=$1
fileIN=$2
fileOUT=$3
$CATCMD $fileIN | \
awk -f... (4 Replies)
Discussion started by: deepak4you
4 Replies
10. Shell Programming and Scripting
I want to print old and new values of some field in Awk script. This is wat I done!
Sample file is as follows
But the output I god is bit different
What must be the problem here?
I am using bash. (2 Replies)
Discussion started by: yogesh_powar
2 Replies