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
breaking out of while loop capri_drm Linux 3 06-19-2008 03:31 PM
rsh breaking me out of loop mark007 Shell Programming and Scripting 1 06-13-2008 08:10 PM
dbx + breaking out of loops JamesGoh High Level Programming 2 11-25-2007 09:36 PM
Breaking Mirror egress1 HP-UX 4 08-25-2004 09:09 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 09-18-2008
scorp_rahul23 scorp_rahul23 is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 19
Breaking line

My input file is like

USER_WORK.ABC
USER_WORK.DEF


I want output file like

ABC
DEF
  #2 (permalink)  
Old 09-18-2008
Tytalus's Avatar
Tytalus Tytalus is offline Forum Advisor  
echo {1..9}^2\;|bc
  
 

Join Date: Jun 2003
Location: Scotland
Posts: 431
Code:
#  sed 's/.*\.//g' infile
ABC
DEF

or

#  awk -F"." '{print $2}' infile
ABC
DEF

or

#  cut -d. -f2 infile
ABC
DEF

...
  #3 (permalink)  
Old 09-18-2008
vijay_0209 vijay_0209 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 52
hi Tytalus,

can u pls explain how this works...?



sed 's/.*\.//g' infile
  #4 (permalink)  
Old 09-18-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,259
Edit: Tytalus was faster, nvm.

Last edited by zaxxon; 09-18-2008 at 08:19 AM..
  #5 (permalink)  
Old 09-18-2008
Tytalus's Avatar
Tytalus Tytalus is offline Forum Advisor  
echo {1..9}^2\;|bc
  
 

Join Date: Jun 2003
Location: Scotland
Posts: 431
Quote:
can u pls explain how this works...?
sed 's/.*\.//g' infile

yeah - sure:
Code:
sed '
s        # substitute
/
.*\.      # anything that matches this pattern - i.e any number of chars followed by a .
//       # with this pattern i.e. nothing - effectively deletes everything up to the .
g'       # globally 
infile
HTH
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 11:34 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