Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 07-30-2008, 04:20 AM   #1
LQ Newbie
Registered: Jul 2008
Posts: 6

Rep: Reputation: 0
How to make 2 variables from one variable value in awk

I have a file, which contains username and role.
in the following code, i try to run a loop , which will take username and provide to SQL (this sql will get information from database, that this exists or not) now i also want to supply the role to SQL.

now i do this.

for myvar1 in $(awk -F, '{print $1,$5}' $Filename $filen|tr "a-z" "A-Z" )
sqlplus -s test/test@test @gur.sql $DefaultProduct $usrrole[1] $usrrole[2]
done >>getdata.tmp

now i want to split the myvar1 value to 2 variables, but its now working and giving error on '('

plz help. i am also unable to use substr, split of any other funcations.
please guide how to use them in awk and ksh.
waiting for help ASAP
Old 07-30-2008, 04:32 AM   #2
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 681Reputation: 681Reputation: 681Reputation: 681Reputation: 681Reputation: 681
What is $filen supposed to be. Do you have two files to process?
Also, you are trying to run awk functions in the bash shell, outside of awk!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you use grep / awk on variables instead of files? zest n zeal Linux - Newbie 2 02-11-2008 12:37 PM
How to tranfer variable out from awk? fanbin Programming 12 07-31-2007 07:21 AM
get variable out from awk sharathkv25 Programming 1 05-08-2007 06:33 PM
awk on a variable onradius Programming 8 02-22-2006 08:34 AM
awk: /matching/ variables passed with -v aunquarra Linux - General 2 02-17-2005 06:47 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:31 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration