LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-22-2013, 12:24 PM   #1
ramsavi
LQ Newbie
 
Registered: May 2013
Posts: 16

Rep: Reputation: Disabled
problem in awk


i have a file like this


Code:
id file path
1 abc as/input/awg
2 cdv df/output/awd

if on command line i have 1 then i have to copy file
Code:
abc

to path
as
Code:
/input/awg

and similarly if it is 2 then copy
Code:
cdv

to
Code:
df/output/awd
 
Old 05-22-2013, 12:28 PM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,830

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
probably this helps: https://www.linuxquestions.org/quest...pt-4175462974/
 
Old 05-22-2013, 01:00 PM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,006

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
I am glad the question made sense to someone
 
Old 05-24-2013, 08:19 PM   #4
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Posts: 952

Rep: Reputation: 217Reputation: 217Reputation: 217
Hi Ramsavi,

You have to break down the problem into the following parts that use known linux programs and concepts.
(1) Choose which Linux utility to use. (You have chosen awk).
(2) How to take the command line argument (1 or 2) and PASS IT IN to awk.
(3) Using awk, read line by line until the first column matches the argument PASSED IN from the previous step.
(4) Take the other columns in this line and create an executable syntax.
(5) EXECUTE it.

What did you try so far?

OK
 
1 members found this post helpful.
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED]Wierd AWK behavior / AWK not reading first line. Involar Linux - Newbie 9 11-28-2012 10:53 AM
awk error awk: line 2: missing } near end of file boscop Linux - Networking 2 04-08-2012 10:49 AM
[SOLVED] call awk from bash script behaves differently to awk from CLI = missing newlines titanium_geek Programming 4 05-26-2011 09:06 PM
AWK problem pppaaarrrkkk Programming 10 02-29-2008 07:29 AM
Awk Problem - Help Me kalyanofb General 1 02-01-2007 05:12 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:34 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration