help in moving


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users help in moving
# 1  
Old 11-20-2005
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

Smilie
# 2  
Old 11-20-2005
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  
Old 11-20-2005
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  
Old 11-20-2005
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  
Old 11-20-2005
Smilie
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  
Old 11-21-2005
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Moving directories

Hi Can I ask a (probably) easy question? I have a range of files in nested directories: subj_01/session_1/AAA/safe.txt subj_01/session_1/AAA/sample.txt subj_01/session_1/DDD/results.txt This is repeated for three sessions for each of subj_{01..026} Is there a way of copying the... (9 Replies)
Discussion started by: montywaite
9 Replies

2. UNIX for Dummies Questions & Answers

Moving Files to VM

Hi guys, i need to test a script on my RedHat which it's mounted on a VirtualBox (oracle VM). So i need to copy a directory with subdirectories, from a remote host to my VM. I'd like to do that within cmd not with program like Filezilla or something like that. Any idea please? (4 Replies)
Discussion started by: Newer
4 Replies

3. AIX

Moving tapes

Hello, anybody out there that is using itdt to manage tape changes in a tape library. The help of itdt show a move subcommand but I can't get it to work. Env: AIX5.3 Dell PowerVault TL2000 tape library -> rmt1 Available 01-08-02 IBM 3580 Ultrium Tape Drive (FCP) # itdt says it finds the... (3 Replies)
Discussion started by: petervg
3 Replies

4. Shell Programming and Scripting

Moving between workspaces

In Linux if Alt+Ctrl+KeyPad# is issued from a Bash shell, will a user then be able to invoke Firefox commands to Firefox from a Bash shell? Would one be able to issue another Alt+Ctrl+Key# to return to the initial workspace containing the Bash script? How do Alt+Ctrl+KeyPad# and Ctrl+F#... (0 Replies)
Discussion started by: slak0
0 Replies

5. UNIX for Dummies Questions & Answers

Moving files

Hi I need to be able to move files from one central locations to different servers on our network. So i want all of our operators to place files to one area on the main storage area. From there i need a script that first checks the file is stable (finished copying) then copy to another server,... (5 Replies)
Discussion started by: treds
5 Replies

6. Shell Programming and Scripting

not moving !!

Hi I have written the following piece of code to move all files with name *.sh to *.bak the o/p i am getting is *.sh.bak Pls help cat filename | while read line do mv $line $line.sh done filename file conatins file.sh file1.sh file2.sh expected o/p is file.bak (2 Replies)
Discussion started by: ultimatix
2 Replies

7. Solaris

Moving zones

Hi, I try to move zone to new server and this is what I done: zoneadm -z myzone halt zoneadm -z myzone deatach cd /mypath/ tar cf myzone.tar myzone ftp it over to new server: tar xf myzone.tar zonecfg -z myzone create -a /mypath/myzone commit exit Problem is here: # zoneadm... (4 Replies)
Discussion started by: mehrdad68
4 Replies

8. Shell Programming and Scripting

Moving files

I wrote a script which moves files on first in first out basis. for i in `ls -ltr | grep ^- | head -10 | awk '{print $9}'` do mv $i Test/ done But donno some reason, this is not working on my Linux box. May i know the reason? Can the above script be done by using positional... (2 Replies)
Discussion started by: venkatesht
2 Replies

9. Shell Programming and Scripting

Moving Files

Hi There, I am trying to move files, the file is present in this location: /iAm4Free/test/generate/txt/information.txt I need to move it to: /iAm4Free/test1/generate/txt/information.txt The only difference is the "test" is replaced with "test1". But the constraint is. The parent... (5 Replies)
Discussion started by: iAm4Free
5 Replies

10. Shell Programming and Scripting

moving between vi files

would any one please tell me which keys we used between opened vi files backward and forward Thanks Ayah (2 Replies)
Discussion started by: aya_r
2 Replies
Login or Register to Ask a Question