LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 07-30-2008, 04:20 AM   #1
intikhabalam
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" )
do
split(myvar1,usrrole,"");
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
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
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!
 
  


Reply


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


All times are GMT -5. The time now is 01:39 AM.

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