![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [sh] String comparison operators | userix | Shell Programming and Scripting | 1 | 05-16-2008 01:09 AM |
| string comparison | fedora | Shell Programming and Scripting | 2 | 01-03-2007 11:20 AM |
| String Comparison between two files using awk | rudoraj | Shell Programming and Scripting | 7 | 07-25-2006 08:04 AM |
| string comparison operators, what are they?? | ballazrus | Shell Programming and Scripting | 11 | 02-13-2006 03:30 AM |
| String Comparison | abey | High Level Programming | 1 | 10-19-2005 09:08 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
string comparison
Hello experts,
(tcsh shell) Quite new to shell scripting... I have got a file with a single word on each line. Want to be able to make a comparison such that i can read pairs of words that are ROT13 to each other. Also, i would like to print the pairs to another file. Any help appreciated.... Thanks in advance ! |
| Forum Sponsor | ||
|
|
|
||||
|
oh yeah - and make it:
Code:
for x in `cat rotfile`; do y=`echo $x | tr '[a-z]' '[n-z][a-m]'`;if [ `grep $y rotfile` ]; then echo $x $y; fi; done | awk '{arr[$1]=$2;if ( arr[$2] != $1 ){print $0}}' > rotfile.out
|
|
|||
|
Appreciate it !
Can understand it and it aint that complicated ! Its just that i am quite new to this type of programming and running out of time as this was just something I had to get out of the way ! Thanks !! |
|
|||
|
Development to my previous post !!
What i did find out was that the error mesg - 'too many arguments' was due to having numbers in the file as well, instead of just characters ! the code does not work with numbers in the file. It only works for files with characters only. Sorry should have mentioned earlier, got numbers in some of my files too !!! Can you help me out here. I am trying as well. Thanks |
|||
| Google UNIX.COM |