- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: find a bad character in a script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2006 03:47 AM
09-11-2006 03:47 AM
for EMPTY_FILE in `ls |grep '^EDI204'`
do
if [ ! -s ${EMPTY_FILE} ]
In the above code the directory listing is being cated together. In other words the the $EMPTY_FILE variable has all files in it instead of a single entry. I suspect a bad non-printable Character is somewhere in the script causing issues.
Any ideas on how to find the rogue character?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2006 03:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2006 03:56 AM
09-11-2006 03:56 AM
Re: find a bad character in a script
You ls will list a bunch of files on the same line (unless you have an alias for ls to be ls -1) since that may not be the case, modify your code to say:
for EMPTY_FILE in `ls -1 |grep '^EDI204'`
do
if [ ! -s ${EMPTY_FILE} ]
etc.
note: the -1 parameter causes every entry to be listed on a line of its own. Hope this helps.
Kofi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2006 04:20 AM
09-11-2006 04:20 AM
Re: find a bad character in a script
for EMPTY_FILE in `ls | grep '^ADD204'`
do
echo "this is empty file $EMPTY_FILE This is the end"
if [ ! -s ${EMPTY_FILE} ]
then
can you explain this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2006 04:32 AM
09-11-2006 04:32 AM
Re: find a bad character in a script
find ${dir_name} -name "EDI204*" -xdev -size 0 -exec #Add what you want to do to these files
** Or you may use | while read line and do what you want to do ..
Please note that 'find' will do down to the subdirectories too.
I am on an aix machine so please check the syntax of 'find' from manpages on an hpux machine. I don't think they are diffrent but it is always good to.
Regards,
Kaps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2006 04:33 AM
09-11-2006 04:33 AM
Re: find a bad character in a script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2006 01:02 AM
09-14-2006 01:02 AM