- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Shell script to compare fields in columns
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
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
12-20-2005 10:20 PM
12-20-2005 10:20 PM
I have a file with two columns of numeric data. I want to compare column1-field1 with column2-field1, column1-field2 with column2-field2...etc. If I see that, in example, column1-field1 is different to column2-field1 I want to do the same test five minutes later and if the situation is the same, then do an action (for example, send a mail).
I want to put the script in the crontab.
Any ideas of how to do it??
Regards,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2005 10:36 PM
12-20-2005 10:36 PM
SolutionYou can use awk to compare fields as simply as,
echo "12 13" | awk '{ if ( $1 > $2) { print "Field1 is bigger";} else { print "Field2 is bigger";}}'
-Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2005 11:25 PM
12-20-2005 11:25 PM
Re: Shell script to compare fields in columns
Please give a few lines of data to test with
For scripting help
www.shelldorado.com
Steve Steel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2005 08:58 PM
12-21-2005 08:58 PM
Re: Shell script to compare fields in columns
you want to stop as soon as the values are different or anyway check all file?
Please explain better what you need.
Rgds,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2005 09:03 PM
12-21-2005 09:03 PM
Re: Shell script to compare fields in columns
do you want to stop to check the values ina file at the first difference, or you want to continue till the end of teh file?
Please, specify better what you need.
Art