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 > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Read from file > process > output to file Lorna Shell Programming and Scripting 3 10-06-2008 01:45 AM
read output in ? pcstalljr Shell Programming and Scripting 3 09-18-2008 11:22 AM
Read output of mii-tool picoaeterna Shell Programming and Scripting 1 02-17-2008 07:27 PM
read file and output message happyv Shell Programming and Scripting 12 01-24-2007 09:57 PM
store output to a file and read from it afadaghi Shell Programming and Scripting 2 10-04-2005 12:00 PM

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 03-02-2009
khestoi khestoi is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 66
Read from a file then filter the output

Hi
i need a script which reads a certain file and then display it on the screen.
The thing is i need to filter the display output.

this is an example of the file which is to be loaded in the script.

asdfg1.1.1|98
hjkldfe4.0.3|123
asdzxzvdweradfsdafascv10.0.10|123456789
/ar/bl/ew/as/qw/ds/as.bc.19980123.asdfgt14:adfjeiop2.0.3|112356
/dfd/eras/xzcv/asdf/asdf/adsf/a.d.c.19990124.fasdf:adfadf11.12.13|1234

now i want the output to be like this only

asdfg1.1.1|98
hjkldfe4.0.3|123
asdzxzvdweradfsdafascv10.0.10|123456789
19980123.asdfgt14:adfjeiop2.0.3|112356
19990124.fasdf:adfadf11.12.13|1234

how can i do this thing?
  #2 (permalink)  
Old 03-02-2009
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,259
Guessing that this 8 digit number is always the 1st string you want to have printed and is always 8 digits long:

Code:
sed 's/^.*\([0-9]\{8\}\..*\)$/\1/g' infile
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 07:07 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