The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Moving /usr ... Is this possible? FredSmith UNIX for Dummies Questions & Answers 4 08-24-2007 04:27 PM
moving AIX ver 4.2.1 to another AIX box gmonix AIX 1 03-02-2006 06:36 PM
moving a file? Holistic UNIX for Dummies Questions & Answers 1 02-20-2003 07:47 PM
moving hardisks Henrik UNIX for Dummies Questions & Answers 2 02-04-2003 01:19 PM
moving directory bb00y High Level Programming 1 12-02-2002 11:39 AM

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 11-20-2005
shafique shafique is offline
Registered User
  
 

Join Date: Nov 2005
Posts: 30
help in moving

can any one help
i have a file with this content file name hsnvalue.op
containing
HSN=0,tool=123
HSN=0,tool=123
HSN=0,tool=123
HSN=0,tool=123
HSN=0,tool=123
HSN=0,tool=123
i want to print only one value to another file final.out

  #2 (permalink)  
Old 11-20-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
I couldnt understand your question properly.
Which value do you want to print ?

Print just one line to final.op

Code:
head -1 hsnvalue.op >> final.out

Print HSN and its value

Code:
echo "HSN=0,tool=123" | awk -F"," '{ print $1 }' >> /tmp/final.op

Print tool and its value

Code:
echo "HSN=0,tool=123" | awk -F"," '{ print $2 }' >> /tmp/final.op


Last edited by vino; 11-20-2005 at 03:14 AM..
  #3 (permalink)  
Old 11-20-2005
shafique shafique is offline
Registered User
  
 

Join Date: Nov 2005
Posts: 30
file hsnvalue.op gets output as
HSN=0,tool=123
HSN=0,tool=123
HSN=0,tool=123
HSN=0,tool=123
HSN=0,tool=123
HSN=0,tool=123
i want to move only one value to another file final.op since all lines are identical how do i get one value,remember the numerical value change every time u run next if u run net tin it give op to hsnvalue.op as
HSN=4,tool=566
HSN=4,tool=566
HSN=4,tool=566
HSN=4,tool=566
HSN=4,tool=566
HSN=4,tool=566
  #4 (permalink)  
Old 11-20-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
Did you go through the possible solutions I put up ?

If you did, you would have found that the first one would be upto your expectations.
  #5 (permalink)  
Old 11-20-2005
shafique shafique is offline
Registered User
  
 

Join Date: Nov 2005
Posts: 30

ya it worked but if i have input file as
HSN=1,total=09
HSN=2,total=09
HSN=3,total=09
HSN=4,total=09
HSN=5,total=09
and want
HSN=2,total=09
HSN=3,total=09
HSN=4,total=09
only to move in another file
  #6 (permalink)  
Old 11-21-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
Here's another thought. It seems that you want to pick out unique lines from your list. Why dont you use uniq ? See man uniq.
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:38 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