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
I would like to separate a line and display accordingly.. suri.tyson Shell Programming and Scripting 6 09-25-2008 08:13 AM
how to show it on separate line userking UNIX for Dummies Questions & Answers 2 07-23-2008 02:01 AM
Separate lines in a single '|' separated line hidnana Shell Programming and Scripting 3 03-17-2008 10:16 AM
AWK line by line instead of field by field? yongho Shell Programming and Scripting 2 07-06-2005 06:49 PM
Listing words from a file on a Separate Line Astudent UNIX for Dummies Questions & Answers 2 03-14-2001 06:44 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 10-13-2008
Satyak Satyak is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 85
Post separate a line having particular field

hi
i have a file containes data like,

20081013-030618.675199 [2712] D 17 Change state DATA_RECEIVE->EOD, RC=0
20081013-030618.868358 [2712] D 17 Reading data...
20081013-030618.868498 [2712] D 18 Received 5 bytes
20081013-030618.868537 [2712] U Buffer received:

now i need to cut the 4th field i.e 17 and write that line into a separate file

please help

thanks in advance
Satya
  #2 (permalink)  
Old 10-13-2008
krishmaths krishmaths is offline
Registered User
  
 

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

Code:
awk '{print $4}' datafile > newfile

  #3 (permalink)  
Old 10-13-2008
otheus's Avatar
otheus otheus is online now Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,889
Looks like sometimes that field doesn't appear. So you might want to augment it with:


Code:
awk '$3 == "D" { print $4 }' datafile >newfile

And just pipe through "sort -u" so that you have only unique id's.
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:40 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