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
How can i read a non text file in unix - ELF-64 executable object file - IA64 alexcol UNIX for Advanced & Expert Users 8 11-07-2008 08:56 AM
Read text file from a specified string to the end bsrajirs UNIX for Advanced & Expert Users 9 01-11-2008 01:05 AM
Post Shell programming: Question about source a file and read data from the file ccwq Shell Programming and Scripting 3 08-04-2007 10:28 PM
pls help me !! about text database shell programming sunattha Shell Programming and Scripting 2 07-20-2007 01:52 PM
How to read specific lines in a bulk file using C file Programming rajan_ka1 High Level Programming 10 11-10-2005 03: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 04-11-2001
sandytul sandytul is offline
Registered User
  
 

Join Date: Apr 2001
Posts: 1
Exclamation

Hello!
I need to read a text file containing certains rows and columns!The following is a sample file with only three rows!

01:41:30:00:05:51 OFF 48506649K 5769415 63494357K
01:41:30:00:05:65 ON 4493546K 27266552 5880264K
01:41:30:00:05:78 OFF 614556K 89121 47291K

1.I need a shell script which would insert a delimiters between each record
2.To trim the "K" in certain records present.
3.To only select the get certain columns.

can anyone helpme in finding a solution for this!
Thanks.
sandytul


  #2 (permalink)  
Old 04-11-2001
PxT's Avatar
PxT PxT is offline Forum Advisor  
Registered User
  
 

Join Date: Oct 2000
Location: Sacramento, CA
Posts: 909
You can use "sed" for numbers 1 and 2. Use "cut" or "awk" for number 3.


sed 's/ /|/g'
sed 's/K$//'
cut -d'|' -f1

You can fill in the details to make a full script...
Closed Thread

Bookmarks

Tags
awk, awk trim, trim, trim awk

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 02:49 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