HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: comparing files using awk
Operating System - HP-UX
1834613
Members
4072
Online
110069
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
12-04-2001 07:06 AM
12-04-2001 07:06 AM
comparing files using awk
Hi,
I'm not a script guy and I'm currently in a situation which is, I need someone who could help me create a simple (for the experts) awk script that will compare system files against users input.
ex. - users entered "SAMPLE.TXT" (usually
upper case)
- systems could have "Sample.txt"
or "sample.txt"
or "sample.TXT"
regardless whatever the system has. Script should match users input against files in the system and proceed it's process. BTW, this is to ftp a file from one machine to another.
Your reply would be greatly appreciated.
Thanks
Joey
I'm not a script guy and I'm currently in a situation which is, I need someone who could help me create a simple (for the experts) awk script that will compare system files against users input.
ex. - users entered "SAMPLE.TXT" (usually
upper case)
- systems could have "Sample.txt"
or "sample.txt"
or "sample.TXT"
regardless whatever the system has. Script should match users input against files in the system and proceed it's process. BTW, this is to ftp a file from one machine to another.
Your reply would be greatly appreciated.
Thanks
Joey
Just starting to learn thru this forum
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2001 07:25 AM
12-04-2001 07:25 AM
Re: comparing files using awk
Hi Joey,
This may not be what you want, and it doesn't use awk, but it'll find all files under a directory, regardless of case, that match the user's input:
================================
#!/bin/ksh
DIR=search-directory
echo Enter filename: '\c'
read FILENAME
find $DIR -type f | grep -i "/${FILENAME}$"
==================================
Obviously, you need to edit the "DIR=" line.
Rgds, Robin.
This may not be what you want, and it doesn't use awk, but it'll find all files under a directory, regardless of case, that match the user's input:
================================
#!/bin/ksh
DIR=search-directory
echo Enter filename: '\c'
read FILENAME
find $DIR -type f | grep -i "/${FILENAME}$"
==================================
Obviously, you need to edit the "DIR=" line.
Rgds, Robin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2001 02:13 AM
12-05-2001 02:13 AM
Re: comparing files using awk
the grep -i option means case insensitive btw.
You probably want the
awk tolower(string) or toupper(string)
but I'll leave it to Robin, to sort that out for you.. he's the awk guru here.. I'm very surprised he didn't come out with it in his earlier post.. usually if there's a question such as how do I change directory, Robin will give you an awk script before telling you about cd !!! ;)
Later,
Bill
You probably want the
awk tolower(string) or toupper(string)
but I'll leave it to Robin, to sort that out for you.. he's the awk guru here.. I'm very surprised he didn't come out with it in his earlier post.. usually if there's a question such as how do I change directory, Robin will give you an awk script before telling you about cd !!! ;)
Later,
Bill
It works for me (tm)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2001 02:55 AM
12-05-2001 02:55 AM
Re: comparing files using awk
Joey,
You don't need awk for this. Is there some compelling reason for you to use awk?
Methinks Richard's "grep -i" should do the trick nicely.
You don't need awk for this. Is there some compelling reason for you to use awk?
Methinks Richard's "grep -i" should do the trick nicely.

The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP