![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| While finding compare the result with given string | mr_bold | UNIX for Dummies Questions & Answers | 4 | 04-24-2008 09:31 PM |
| compare string in two files | MiLKTea | Shell Programming and Scripting | 2 | 03-10-2008 05:35 AM |
| Compare string to a pattern | jerryte | Shell Programming and Scripting | 2 | 01-25-2008 08:37 PM |
| Compare Char to String | Phobos | High Level Programming | 3 | 04-09-2005 11:01 AM |
| string compare | gundu | Shell Programming and Scripting | 3 | 03-23-2005 04:42 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
String compare
Hi Friends,
Can anyone help me with comparing the records in twofiles, I have two files (csv) FILE1: 1023,SMITH JAMES , (203) 789-1249 1023,HARRY POTTER , (213) 789-1249 1023,JONES D, (903) 789-1249 FILE1: 1023,SMITH ,2037891249 1023,HARRY , 2137891249 1023,JONES, 7037891249 it should return only one row i.e 1023,JONES, 7037891249 as they are different,It has to supress the "(" chareacters and blank ones. Thanks in advance for your help. S ![]() (203) 789-1249 and 2037891249, I have to compare these Last edited by sbasetty; 01-29-2007 at 03:48 PM.. |
|
||||
|
here's an idea to start with:
Code:
[root@localhost test]# echo "1023,SMITH , (203) 789-1249" |sed 's/[-() ]//g' 1023,SMITH,2037891249 Code:
[root@localhost test]# sed -i 's/[-() ]//g' file [root@localhost test]# sed -i 's/[-() ]//g' file2 [root@localhost test]# diff file file2 3c3 < 1023,JONES,9037891249 --- > 1023,JONES,7037891249 |
|
||||
|
Quote:
Thanks in advance. An awk student. |
|
||||
|
Thank you all,
Small clarification on this: How can we use sed on a perticular column (third column in this example), sed 's/[-() ]//g' is processing all the columns. I have two files to compare. [root@localhost test]# echo "1023,SMITH , (203) 789-1249" |sed 's/[-() ]//g' 1023,SMITH,2037891249 |
|
||||
|
Hi Randuolov,
will this command displays only the changed data can you please explain. when I run this command it is displaying same file with the data. Thanks Quote:
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|