The UNIX and Linux Forums  


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
awk program to select a portion of a line anju Shell Programming and Scripting 3 01-11-2008 06:33 AM
How to select line by line in shell preethgideon UNIX for Dummies Questions & Answers 15 10-12-2006 05:35 PM
Select matches between line number and end of file? Jerrad Shell Programming and Scripting 4 05-24-2006 08:50 AM
awk to select a column from particular line number mab_arif16 Shell Programming and Scripting 4 05-08-2006 06:26 AM
Filed substitution with awk tony3101 Shell Programming and Scripting 1 09-14-2004 04:02 PM

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 04-10-2008
grajesh_955 grajesh_955 is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 18
How to Select or cut from the certain filed to the end of the line

Hi:

I have few rows in file..Like suppose...
9063C0 44 00051363603253033253347 3333 070248 06
9063C0 5G PAN00013
9063C0 44 00061030305040404250724 0506 100248 08
9063C0 43 01 00000089

I need to cut the row starting after "9063C0" till the end of the line and store in another file...

My o/P is:
44 00051363603253033253347 3333 070248 06
5G PAN00013
44 00061030305040404250724 0506 100248 08
43 01 00000089
  #2 (permalink)  
Old 04-10-2008
helper helper is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 25
Arrow Use grep and sed combination

Hi Rajesh,


Use grep and sed combinations to do the need.

grep ^9063C0 test | sed 's/^9063C0//'
where test is the file name.

OUTPUT :
===========
$> grep ^9063C0 test
9063C0 44 00051363603253033253347 3333 070248 06
9063C0 5G PAN00013
9063C0 44 00061030305040404250724 0506 100248 08
9063C0 43 01 00000089


$> grep ^9063C0 test | sed 's/^9063C0//'
44 00051363603253033253347 3333 070248 06
5G PAN00013
44 00061030305040404250724 0506 100248 08
43 01 00000089


Hope this is what u wanted......

Last edited by helper; 04-10-2008 at 07:20 AM..
  #3 (permalink)  
Old 04-10-2008
helper helper is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 25
Hi Rajesh,


Use grep and sed combinations to do the need.

grep "9063C0" test | sed 's/9063C0//'
where test is the file name.

OUTPUT :
===========
$> grep ^9063C0 test
9063C0 44 00051363603253033253347 3333 070248 06
9063C0 5G PAN00013
9063C0 44 00061030305040404250724 0506 100248 08
9063C0 43 01 00000089


$> grep ^9063C0 test | sed 's/9063C0//'
44 00051363603253033253347 3333 070248 06
5G PAN00013
44 00061030305040404250724 0506 100248 08
43 01 00000089


Hope this is what u wanted......
  #4 (permalink)  
Old 04-10-2008
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,554

Code:
awk '{ $1=""; print }' file

  #5 (permalink)  
Old 04-10-2008
krishmaths krishmaths is offline
Registered User
  
 

Join Date: Sep 2006
Location: Mysore, India
Posts: 191

Code:
cut -d" " -f 2- test

  #6 (permalink)  
Old 04-10-2008
grajesh_955 grajesh_955 is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 18
Thankx all... Its working.........
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:28 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