Find a file that could have different endings


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Find a file that could have different endings
# 8  
Old 02-07-2011
Can you provide more info?

Copy/paste what you are typing and what is being returned by the command.
# 9  
Old 02-07-2011
Please post representative real filenames. Your posts suggest that the filenames themselves actually contain asterisk characters. As that is unlikely that could be your problem.

Does this find the file? Note that this is "ls -1" (one) not "ls -l" (ell) .
Code:
ls -1 *HOSPCK


Quote:
ls -l *\*\*\
This is bothering me. You aren't using MSDOS directory syntax in unix are you ???

Perhaps this will find your file in unix:
Code:
find . -type f -name '*HOSPCK' -print


Last edited by methyl; 02-07-2011 at 01:46 PM.. Reason: Epanded post
# 10  
Old 02-07-2011
1st command:
Code:
ls -1 *\*\*\HOSPCHK*

Returns:
Code:
xxxx/xxxx/xxxxx/hospchk020111
xxxx/xxxx/xxxxx/hospchk020111.dtl

2nd Command:
Code:
ls -1 *\*\*\HOSPCHK* | awk -F. '{if ($2<="") print $1}'

Results:
Code:
The system cannot find the file specified


Last edited by Scott; 02-07-2011 at 02:02 PM.. Reason: Code tags
# 11  
Old 02-07-2011
A couple things come to mind...

Are there any . characters other than at end of:
xxxx/xxxx/xxxxx/hospchk020111
xxxx/xxxx/xxxxx/hospchk020111.dtl

Perhaps the / character is confusing things.
Can you
Code:
ls -1 *\*\*\HOSPCHK* | awk -F. '{ print NF $2}'

to show what awk thinks is the count of fields and what is in the 2nd field
# 12  
Old 02-07-2011
I think you would fine the command posted by methyl to be a good solution.
The only thing I have had is a issue with the "*" so I have done the find as such.
Code:
find . -type f -name "*"HOSPCK"*" -print

But it was a odd situation that forced the double quotes but it does work.
# 13  
Old 02-07-2011
Command:
Code:
ls -1 *\*\*\HOSPCHK* | awk -F. '{ print NF $2}'

produces two results
Code:
2xxx/xxxx/xxxx/HOSPCHK020111
3xxx/xxxx/xxxx/HOSPCHK020111

The reason I am using the *\*\*\ is because the file can be listed under one of these subdirectories....it could be like nathan\a155\1\hosp* or it could be under jonathan\a155\1\hosp* ...I couldn't get the find command to work it says FIND: Parameter format not correct.

This is Lawson Interface Desktop if you are familiar with that application.

Thanks for all the responses so for.

Last edited by Scott; 02-07-2011 at 02:29 PM..
# 14  
Old 02-07-2011
Yes I work in a Lawson environment on AIX.
and find should be able to transverse the directories.
So you should be telnet'd into the system and running at a command line correct. Or are you running from the Lawson desktop client?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Tip to remove line endings and spaces on a pre-formatted text file?

Hi, At the moment, using Notepad++ to do a search and replace, manually section by section which is real painful. Yeah, so copying each section of the line of text and putting into a file and then search and replace, need at least 3-operations in Notepad++. Here's hoping I will be able to... (1 Reply)
Discussion started by: newbie_01
1 Replies

2. Shell Programming and Scripting

Sendmail ignoring line endings

Mails from Sendmail are ignoring line endings, when I try to send email with attachment. I have tried to specify the font in the html but line endings are still ignored. I also tried unix2dos, still no luck. #!/usr/bin/ksh ###Send Email MAILTO=`cat mail2.list | tr -s '\n' ','` SUBJECT="bla bla... (3 Replies)
Discussion started by: aydj
3 Replies

3. Shell Programming and Scripting

How to find a file with a specific pattern for current sysdate & upon find email the details?

I need assistance with following requirement, I am new to Unix. I want to do the following task but stuck with file creation date(sysdate) Following is the requirement I need to create a script that will read the abc/xyz/klm folder and look for *.err files for that day’s date and then send an... (4 Replies)
Discussion started by: PreetArul
4 Replies

4. Shell Programming and Scripting

wanted to find both link file and ordinary file using single find command

find . -type fl o/p is only the ordinary file. where in it wont give the link files. (2 Replies)
Discussion started by: nikhil jain
2 Replies

5. UNIX for Advanced & Expert Users

vimrc help with line endings

I was reading this and thought I could put this in my vimrc and it would convert the line endings to unix. Am I doing something wrong or am I missing something? set ff=unixManaging/Munging Line-Endings with Vi/Vim | Jeet Sukumaran I used this command and it confirms that my global option is... (2 Replies)
Discussion started by: cokedude
2 Replies

6. UNIX for Advanced & Expert Users

line endings help of non-ASCII files

When you are dealing with ASCII files it easy to check on line endings type. You can just use the file command. You are not always lucky enough to be dealing with ASCII files. So in the cases that you don't have ASCII files how can you check what type of line endings you have? Please list all... (5 Replies)
Discussion started by: cokedude
5 Replies

7. UNIX for Advanced & Expert Users

Vi line endings conversions

I was reading these 2 articles. Why does the wikia one think :e ++ff=dos? Or am I just misunderstanding it? :e ++ff=unix :e ++ff=dos File format - Vim Tips Wiki Managing/Munging Line-Endings with Vi/Vim | Jeet Sukumaran (1 Reply)
Discussion started by: cokedude
1 Replies

8. Shell Programming and Scripting

Problems with Sed/awk/grep and line endings

Hello I have created the following script, which is designed to manipulate a text document: #!/bin/sh # Get 3 lines, (last of which is "Quantity"); adjust order; put all three on one line with tabs. FILENAME=~/Desktop/email.txt LIST=$(grep -B2 "Quantity" ${FILENAME} |awk 'BEGIN { FS = "\n"; RS... (6 Replies)
Discussion started by: benwiggy
6 Replies

9. UNIX for Dummies Questions & Answers

how to find a file named vijay in a directory using find command

I need to find whether there is a file named vijay is there or not in folder named "opt" .I tried "ls *|grep vijay" but it showed permission problem. so i need to use find command (6 Replies)
Discussion started by: amirthraj_12
6 Replies
Login or Register to Ask a Question