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 > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Printing value with no obvious field seperator Donkey25 Shell Programming and Scripting 4 03-14-2008 06:57 AM
How to change field seperator onthetopo Shell Programming and Scripting 2 05-11-2007 12:11 PM
find columns with whitespace as field seperator? tkbharani UNIX for Advanced & Expert Users 8 03-14-2007 01:13 AM
field separator as regexp Abhishek Ghose Shell Programming and Scripting 2 02-15-2006 08:49 PM
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 Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-08-2007
ramky79 ramky79 is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 56
regexp to print after a field seperator

Hi,
How do i Print anything after a ':'

Ex :
file1: 1235131(rs32553)

I want to print out "1235131(rs32553)"
how do i do it. I know we can do this using awk but looking for the right syntax.


Any help appreciated.

Thanks,
Ram
  #2 (permalink)  
Old 05-08-2007
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
Code:
echo 'file1: 1235131(rs32553)' | sed 's/.*:\(.*\)/\1/'
  #3 (permalink)  
Old 05-08-2007
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
Code:
echo "file1: 1235131(rs32553)" | sed 's/^.*://'
sed works, too.
  #4 (permalink)  
Old 05-08-2007
aigles's Avatar
aigles aigles is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,416
Another way with cut :
Code:
echo "file1: 1235131(rs32553)" | cut -d: -f2-
Jean-Pierre.
  #5 (permalink)  
Old 05-09-2007
anbu23 anbu23 is offline Forum Advisor  
Registered User
  
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,398
Code:
echo "file1: 1235131(rs32553)" | awk ' sub("[^:]*:","") '
  #6 (permalink)  
Old 05-09-2007
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
Code:
echo "file1: 1235131(rs32553)" |awk -F: '{print $2}'
  #7 (permalink)  
Old 05-09-2007
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,847
Code:
$ echo "file1: 1235131(rs32553)"|{ read; echo "${REPLY#*: }";}
1235131(rs32553)
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 04:24 PM.


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