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 > 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
Cksum dependencies vibhor_agarwali UNIX for Advanced & Expert Users 3 09-05-2007 02:38 AM
The cksum Problem Dim-Wit Shell Programming and Scripting 7 08-15-2006 02:03 PM
cksum question rjsha1 Shell Programming and Scripting 4 01-17-2006 11:44 AM
Anyone know how cksum works? kapolani Shell Programming and Scripting 5 10-28-2004 09:46 AM
cksum all executables on drive crazykelso UNIX for Dummies Questions & Answers 2 07-17-2002 10:52 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 05-31-2007
leeRoberts2007 leeRoberts2007 is offline
Registered User
  
 

Join Date: May 2007
Posts: 4
using cksum

hi,

I am trying to use the cksum feature in unix. when i make a call to it i get returned something along the lines of:

4603435 14 file3

how do i get the first part of this response only; i.e:

4603435

I'm trying to use at a way without the use of sed and creating temp files. The manual doesn't seem to allow for picking out fields. If this isnt possible, the next simplest solution would be useful.

Thanks for your time

Lee
  #2 (permalink)  
Old 05-31-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
I often use functions in shell scripts to do this such as

Code:
first()
{
    echo $1
}
so if you do

A=`first one two three`

then A will be one.
  #3 (permalink)  
Old 05-31-2007
leeRoberts2007 leeRoberts2007 is offline
Registered User
  
 

Join Date: May 2007
Posts: 4
i'm not sure i follow, how can i apply this to the cksum command?
  #4 (permalink)  
Old 05-31-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Code:
#!/bin/sh

first()
{
   echo $1
}

for d in $@
do
     first `cksum $d`
done
  #5 (permalink)  
Old 05-31-2007
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,509
Quote:
Originally Posted by leeRoberts2007

how do i get the first part of this response only; i.e:

4603435
Code:
cksum file | awk '{print $1}'
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 12:53 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