Problem with find command at ksh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem with find command at ksh
# 8  
Old 05-23-2012
As per my understanding, command is working fine(which one I used). B'coz on RHEL machine its showing 5_*.*: No such file or directory
but on AIX machine its showing find: 0652-019 The status on 1_*.* is not valid.
Context is the same of both saying.
So what I'm thinking to do(now) that How can I put a customized message like: "No file with this name", when there is no file.
Plz help me with that.

---------- Post updated at 05:09 AM ---------- Previous update was at 05:01 AM ----------

I tried:
Code:
if [$? -nq 0] | awk '{print}' | else echo " File not found"

I knew it would through an error. and So it did :-)
I need help with this Smilie

Last edited by Franklin52; 05-23-2012 at 07:37 AM.. Reason: Please use code tags for code and data samples
# 9  
Old 05-25-2012
3-4 days to a thread....no reply for the questions SmilieSmilieSmilie what happened Unix Gurus...plz help
# 10  
Old 05-25-2012
Quote:
Originally Posted by sukhdip
3-4 days to a thread....no reply for the questions SmilieSmilieSmilie what happened Unix Gurus...plz help
change like this
Code:
.................
.............
....|find "$filename"_*.* -type f ! -name ".*" 2>errorlog|....
if [ -s errorlog ] ; then echo "No file with this name";fi
.................
.............

# 11  
Old 05-25-2012
thanks alot @ygemici it is working....


Last edited by sukhdip; 05-25-2012 at 09:04 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh script find command not printing any results

Hello, Hitting a wall on this one. When at the command prompt it works fine: # find /home/testuser -name 'PAINT*canvasON.txt' /home/testuser/PAINT_canvasON.txt # pwd /home/testuser # ls -l PAINT*canvasON.txt -rw-r--r-- 1 root user 23 Feb 07 02:58 PAINT_canvasON.txt... (2 Replies)
Discussion started by: seekryts15
2 Replies

2. Shell Programming and Scripting

find command to move the files to other folder - ksh 88

Hi , I've learnt that the following command will remove the files from the given folder for given no.of days find /home/etc -type f -atime -10 -exec rm -f {} \; But how can I change the above command that will move the files to another specified directory instead of removing the... (1 Reply)
Discussion started by: smile689
1 Replies

3. Shell Programming and Scripting

Regular Expression in Find command [KSH]

Hello, I am trying to use regex wtih find command in KSH. For some reason it is not working as expected. Input: comm_000_abc_0102.c comm_000_abc.c 456_000_abc_1212.cpp 456_000_abc_.cpp Expected Output: comm_000_abc_0102.c kkm_000_abc_8888.cpp (Basically I want to find all... (6 Replies)
Discussion started by: vinay4889
6 Replies

4. Shell Programming and Scripting

ksh - find command with 2 actions attached and error logging

Hi there, I'm encountering problems on an AIX system when using following in my script. find . -name *.edi -type f -exec sh -c 'scp {} $user@$server:$path || exit 5; mv {} $sent || exit 7' \; the error i get is following find: 0652-018 An expression term lacks a required... (4 Replies)
Discussion started by: Kerberos
4 Replies

5. Shell Programming and Scripting

problems with ksh array and find command

set -A allfiles `find $usrhtml -type f` i am trying to populate this array with the find command. It works fine when find is looking through a single directory but when i add a new subdirectory the files in the subdirectory get duplicated. Can anyone help me and fix this so each files in... (1 Reply)
Discussion started by: bjhum33
1 Replies

6. Shell Programming and Scripting

Help - Using Find command on dynamic files on KSH

Hi Forum. When I run the following find command, I get the desired results: find . \( -name a.out -o -name '*.o' -o -name 'core' \) -type f -ls I want for my script to dynamically calculate and assign a variable var1 to contain all the files that I want to search instead of hard-coding. ... (2 Replies)
Discussion started by: pchang
2 Replies

7. Shell Programming and Scripting

problem with KSH script: command line args

Hi I am executing a KSH script by passing command line arguments example: Red Green Dark Red Blue when I am splitting the arguments by using " "(Space) as delimiter But the colour Dark Red is a single parameter. But it is getting splitted in between How to avoid this. Please help Also... (4 Replies)
Discussion started by: hemanth424
4 Replies

8. Shell Programming and Scripting

Problem with embedded FTP command in Ksh - System Cannot find the specified path.

I have the following FTP embedded in a Ksh script on AIX 5.3 ftp -n <<WHATEVER open 10.101.26.218 user hcistats ******* ascii put $thupdatefile put $thcollectfile quit WHATEVER Here is what my script returns: ... (3 Replies)
Discussion started by: troym72
3 Replies

9. UNIX for Dummies Questions & Answers

problem with output of find command being input to basename command...

Hi, I am triying to make sure that there exists only one file with the pattern abc* in path /path/. This directory is having many huge files. If there is only one file then I have to take its complete name only to use furter in my script. I am planning to do like this: if ; then... (2 Replies)
Discussion started by: new_learner
2 Replies

10. UNIX for Advanced & Expert Users

find command from shell scipt (ksh) problem

Hi experts, I have a simple shell script as follows. #!/bin/ksh FIND_STRING="\( -name 'testfile*.Z' -o -name 'DUMMY_*' \) " find /tmp -type f $FIND_STRING -print When I run this with ksh -x testscript, I get the following output. + FIND_STRING=\( -name 'testfile*.Z' -o -name... (6 Replies)
Discussion started by: kodermanna
6 Replies
Login or Register to Ask a Question