The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > SUN Solaris
.
google unix.com



SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems .

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to change field seperator onthetopo Shell Programming and Scripting 2 05-11-2007 01:11 PM
Can a shell script pull the first word (or nth word) off each line of a text file? tricky Shell Programming and Scripting 5 08-17-2006 07:29 AM
Using | as a seperator in join firvin UNIX for Dummies Questions & Answers 5 03-28-2006 12:23 PM
Comma seperator premar Shell Programming and Scripting 6 02-17-2006 04:16 AM
Awk Field Seperator Help insania Shell Programming and Scripting 3 11-11-2005 04:29 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-09-2006
qrshat qrshat is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 1
how i can use a WORD for seperator

hi,

i want to use A WORD for seperator in awk or especially in cut. how i can perform this. is there any way to use a word for seperator.

For example: i want to list all word after FROM and the files name contains this word.

chatnorollback.svc: delete from info where nick
chatnorollback.svc: delete from webbilling where
chatnorollback.svc: delete from webbilling where
chatnorollback.svc: sql {delete from login where
chatnorollback.svc: sql {delete from odablack
chatnorollback.svc: sql {delete from blacklist
chatnorollback.svc: sql {delete from info where
chatnorollback.svc: sql {delete from register

thanks in advance,
  #2 (permalink)  
Old 02-09-2006
reborg's Avatar
reborg reborg is online now Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,230
Not really, but this might help.


Code:
sed -n 's/^\([^ ][^ ]*\).*from/\1/p' file.txt
  #3 (permalink)  
Old 02-09-2006
Ygor's Avatar
Ygor Ygor is offline Forum Staff  
Moderator
  
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,409
Set the awk built-in variable FS (Field Separator) to the value you want...
Code:
awk -v FS=from '{print $2}' file.txt
The details are in the awk manual: Specifying how Fields are Separated
  #4 (permalink)  
Old 02-10-2006
reborg's Avatar
reborg reborg is online now Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,230
Ygor, of course you're correct. I had some strange notion in my head about only being able to use on char as the FS.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:47 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0