Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-15-2008, 05:19 AM   #1
LQ Newbie
Registered: Sep 2008
Posts: 1

Rep: Reputation: 0
Unhappy field separation not using awk -f option

Hi all,
my problem is to separate two fields which are separated by = not using the awk command..
suppose if I give " -dir=/usr/home/ " this line I should be able to get "-dir" and "/usr/home" separately. in this case = is the separation character. so is there any way I can separate two fields not using awk -f command..???
Old 09-15-2008, 02:28 PM   #2
Registered: Jun 2008
Posts: 235

Rep: Reputation: 46

this is because the -f option of awk does NOT define field separators. It defines a script to execute in awk. You want to use -F.

If you do not want to use awk, you could use cut:
FNAME=`echo "-dir=/my/path" | cut -f1 -d=`
FPATH=`echo "-dir=/my/path" | cut -f2 -d=`

Last edited by jan61; 09-15-2008 at 02:31 PM.


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
deleting a field using awk jkeertir Linux - Newbie 5 04-13-2008 11:55 PM
How to parameterize which field awk should print? dbland07666 Linux - Newbie 2 10-29-2007 04:49 PM
awk: how to find expression in a certain field? Micro420 Programming 5 08-08-2007 06:59 PM
My field separator changes when using awk Helene Programming 3 05-01-2004 09:10 AM
Two field seperators in awk?? Astro Programming 2 11-09-2003 11:12 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:49 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration