find file with space and cksum


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting find file with space and cksum
# 1  
Old 12-02-2009
find file with space and cksum

find . -type f | xargs cksum

this command is failing for the files which has a space in between them

any quick solution ? preferably one liner
# 2  
Old 12-02-2009
From the man page for GNU find:
Quote:
-print0
True; print the full file name on the standard output, followed by a null character (instead of the newline character that `-print' uses). This allows file names that contain newlines or other types of white space to be correctly interpreted by programs that process the find output. This option corresponds to the `-0' option of xargs.
From the man page for GNU xargs:
Quote:
--null, -0
Input items are terminated by a null character instead of by whitespace, and the quotes and backslash are not special (every character is taken literally). Disables the end of file string, which is treated like any other argument. Useful when input items might contain white space, quote marks, or backslashes. The GNU find -print0 option produces input suitable for this mode.
Combining the two:
Code:
find . -type f | xargs chksum

Or, much much simpler, and works across all platforms:
Code:
find . -type f -exec chksum {} \;

# 3  
Old 12-02-2009
if you insist to use xargs:

Code:
find . -type f | xargs -i cksum "{}"

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find File with space

Hello All, I have path /allcode/mainld/process/recenttmp where I get many type of file from other platforms. so in UNIX I need to process all file present in this location. but I don't want to process files with the space and delete them. Please provide your suggestion. (7 Replies)
Discussion started by: kumar30213
7 Replies

2. UNIX for Dummies Questions & Answers

Changing only the first space to a tab in a space delimited text file

Hi, I have a space delimited text file but I only want to change the first space to a tab and keep the rest of the spaces intact. How do I go about doing that? Thanks! (3 Replies)
Discussion started by: evelibertine
3 Replies

3. Red Hat

Help to Find out Available disk space

I need to find available disk space for /home. $ df /home Filesystem 1K-blocks Used Available Use% Mounted on /dev/mahhh/VolGroup11-LogVol00 32281452 45028 26034172 15% / $df /home |tail -1| awk '{print $4}' 15% The above result shows the... (5 Replies)
Discussion started by: Anu_1
5 Replies

4. UNIX for Dummies Questions & Answers

command to find cksum of all files inside a directory?

I did this: ls -lrRt | grep ^* | cksum * but it is showing cksum of sub-directories. Thanks You Please use code tags when posting data and code samples, thank you. (3 Replies)
Discussion started by: ezee
3 Replies

5. Shell Programming and Scripting

how to find a job which is writing a big file and eating up space?

how to find a job which is writing a big file and eating up space? (3 Replies)
Discussion started by: rush2andy
3 Replies

6. Shell Programming and Scripting

find the folder with space in name.

A solaris server with SAMBA share folder. The PC users created many folders with space on it, I want to find them out, but not list its subfolders. For example, I have below folders Copy of ABC/efg/xy sa/Test again/xyt If I use command: find . -type d |grep " " I will list 6 folders, but... (2 Replies)
Discussion started by: rdcwayx
2 Replies

7. Shell Programming and Scripting

EEPROM CKSUM? what is this?

Hi all, So I have a binary file and I need to generate an expected EEPROM checksum for it. Ideally, I would like to input the file (with the path) and output a computed checksum. Ive been using (cksum file1) with no avail and I was just curious as to whether there is such thing as EEPROM cksum,... (1 Reply)
Discussion started by: TeamUSA
1 Replies

8. UNIX for Dummies Questions & Answers

How to find a file whick is consuming larger disk space in file system

Hello, Can anybody please tell me the command to find out the filesystem or a file which is consuming larger disk space sing i want to find out the file and want to compress it please help me out any help would be appreciated (6 Replies)
Discussion started by: lokeshpashine
6 Replies

9. Shell Programming and Scripting

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... (4 Replies)
Discussion started by: leeRoberts2007
4 Replies

10. UNIX for Dummies Questions & Answers

cksum parts of a file

Every time we build an executable the date and time are put into the file, I need to run checksum on just the working lines.(IE, no header files) Is this even possible, if so how would I go about it? I am using a HP-UX server any help you can give me will be greatly appreciated. Thanks (6 Replies)
Discussion started by: crazykelso
6 Replies
Login or Register to Ask a Question