korn shell to cut command output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting korn shell to cut command output
# 1  
Old 11-17-2011
korn shell to cut command output

hello,

i use following command:

md5sum TEST.xml

the output looks like:

900hjidur84hjr938ikv TEST.xml

as you can see, the first part is the md5 code, the second part is the file name, but i only want the first part(md5 code), and save it to a file, how to do that? thanks.
# 2  
Old 11-17-2011
Code:
md5sum TEST.xml | awk '{ print $1 }' > output

# 3  
Old 11-17-2011
Thank you very much, it help a lot
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Storing command output in a variable and using cut/awk

Hi, My aim is to get the md5 hash of a file and store it in a variable. var1="md5sum file1" $var1 The above outputs fine but also contains the filename, so somthing like this 243ASsf25 file1 i just need to get the first part and put it into a variable. var1="md5sum file1"... (5 Replies)
Discussion started by: JustALol
5 Replies

2. Shell Programming and Scripting

Assinging output of cut command

Hi, I have the files in the following files in a folder 19996587342 19487656550 19534838736 And i need to get the first 6 characters from the abvoe files so i used the following script #!/bin/ksh for i in 19* do txt= `$i | cut -c -6` echo "$txt" done The error is at... (4 Replies)
Discussion started by: smile689
4 Replies

3. Shell Programming and Scripting

Korn shell. wait command and crontab

I have the following ksh script: sqlplus usr1/pw1@DB1 @$DIR/a.sql $1 & sqlplus usr2/pw2@DB2 @$DIR/b.sql $1 & wait echo "Done!" Where $DIR is a variable with the absolute path where a.sql and b.sql are. For some time, I've been running this script daily and it works fine. The intentions is... (5 Replies)
Discussion started by: acarpio89
5 Replies

4. Shell Programming and Scripting

Write output to a file using Korn shell script

All, Can anyone please help me with the below scenario in korn shell script. Can anyone please give me some hints to proceed on this. I have a Flat file of the below format. Input file format:... (1 Reply)
Discussion started by: sp999
1 Replies

5. Shell Programming and Scripting

How to cut selected lines from command output

Hi guys, I need to cut the first 12 system processes from the command ps -A. I know that the cut command forms part of the pipeline but can't understand how to cut the first 12 lines and later display them on standard output. Please help! Many thanks, Jared. (3 Replies)
Discussion started by: jjb1989
3 Replies

6. Shell Programming and Scripting

Find command in Korn Shell

Hi, I am trying to execute the below in Ksh (telnet) find ./request.txt -mmin -30 It says find: bad option -mmin What i am trying to do is by using find command i am checking wheather the file request.txt is there for 30 minutes or not Please help (1 Reply)
Discussion started by: chinniforu2003
1 Replies

7. Shell Programming and Scripting

problem with set command in korn shell

I have to copy an array to a temp variable and back after doing some functions. I am trying to see if it is possible to do without while loops.My closest try was set -A temp ${THE_ARRAY} # restore array after some actions set -A THE_ARRAY ${temp} The problem with above is that, the new... (1 Reply)
Discussion started by: vijay1985
1 Replies

8. UNIX for Dummies Questions & Answers

Maximum Command Length for Korn shell

What is the maximum size of a command which can be given in telnet command prompt in unixfor Korn shell? (2 Replies)
Discussion started by: miltony
2 Replies

9. Shell Programming and Scripting

Command ignored after sftp - korn shell

Hi all Trying to run my korn shell script, I got no messages after the sftp. The "finished" msg is not being displayed. Any ideas? sftp $argument <<EOF quit EOF echo "finished" Thanks in advance, :O) (1 Reply)
Discussion started by: alienET
1 Replies

10. UNIX for Dummies Questions & Answers

How can I cut output of command??

I am on a Linux system using bash shell. I only want to see the number in the Use% field as the output. #df -h / Filesystem Size Used Avail Use% Mounted on /dev/dasda1 2.3G 2.1G 51M 98% / !#/bin/bash df -h / | awk '{print $5}' | cut -c1-2 Us 98 How do... (2 Replies)
Discussion started by: darthur
2 Replies
Login or Register to Ask a Question