LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 05-05-2008, 06:21 AM   #1
jkeertir
Member
 
Registered: Mar 2008
Posts: 70

Rep: Reputation: 15
awk query


Dear All,

I have two strings as
s="192.168.0.102"
s1="192.168.0.100"

how can i compare these two strings using awk or in shell script.

Please can anyone help me to solve this issue.

With Regards,
Keerti.
 
Old 05-05-2008, 06:32 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
Try the "string" command...."man string" for details.
(found on Google--now I learned something too.)
 
Old 05-05-2008, 06:55 AM   #3
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,453

Rep: Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941
@pixellany: I tried man string, but it points to C/C++ functions related to string operations. I've never heard of a string command, except for the command strings to print ascii characters from a binary.

@jkeertir: it depends on how do you want to compare them. In awk the string and numeric comparison operators are the same, so you can use = != > >= and so on. In bash the string comparison is done by = != > >= and so on, whereas the numeric comparison uses -eq -ne -gt -ge and so on.
 
Old 01-17-2014, 04:12 AM   #4
jags1984
Member
 
Registered: Mar 2013
Posts: 42

Rep: Reputation: Disabled
Check this URL it seems your question is answered here

http://www.linuxquestions.org/questi...ng-4175449975/




If you found the solution, Mark it as SOLVED
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
awk query jkeertir Linux - Networking 3 04-07-2008 08:07 AM
interesting MySQL query/view query :s mjh Programming 3 03-25-2008 07:30 AM
Some comments on awk and awk scripts makyo Programming 4 03-02-2008 05:39 PM
awk program. a little query! indiancosmonaut Programming 7 07-05-2007 09:48 AM
help with mysql query: return nth rows in query hawarden Programming 2 07-31-2006 06:36 PM


All times are GMT -5. The time now is 09:46 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration