![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum 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 |
| Unix file operations(shell script) | nivas | Shell Programming and Scripting | 6 | 02-07-2008 04:11 AM |
| File operations | monks | UNIX for Dummies Questions & Answers | 2 | 04-26-2006 04:26 AM |
| File operations | chiragmistry21 | Shell Programming and Scripting | 2 | 03-27-2006 02:00 PM |
| where i can find list of UNIX commands for daily operations ? | mgoutham | UNIX Desktop for Dummies Questions & Answers | 1 | 03-02-2006 11:35 AM |
| mathematics operations in unix | cesar720213 | UNIX for Dummies Questions & Answers | 2 | 11-22-2001 08:24 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Unix File operations
Hi,
Iam having the two files as follows: file1: ASQWEDFR09876543121234512 POIUYTREW09876512345676788 ZXCVBNMKS1209888888888888 file2: ASQWEDFR09876543121234516 asdcvfgbtg@abc.com 0000000-90-1239--2008 8990---- CXADFGTU09876543121234789 asdcvfgbtg@abc.com 0000000-90-1239--2008 8990---- KLOPIUYRE09876541234234516 asdcvfgbtg@abc.com 0000000-90-1239--2008 8990---- ZXSDCVFG09876512345634516 asdcvfgbtg@abc.com 0000000-90-1239--2008 8990---- i WANT TO update the contents in file1 to file2 and remove the other lines. example.: ASQWEDFR09876543121234516 asdcvfgbtg@abc.com 0000000-90-1239--2008 8990---- POIUYTREW0987651234567678 asdcvfgbtg@abc.com 0000000-90-1239--2008 8990---- ZXCVBNMKS1209888888888888 asdcvfgbtg@abc.com 0000000-90-1239--2008 8990---- |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
paste file_update file_to_be_updated | awk ' { print $1" " $3" "$4}' > final
cat final > file_to_be_updated |
|
#3
|
|||
|
|||
|
grep -f file1 file2 > out.txt
|
|
#4
|
|||
|
|||
|
Unix File operations
Hi,
Thanks for your reply. It is working fine, but iam having the file 2 as follows: file 2 Code:
QWERTYUI098765432112345 abc@soft.com 2007-09-260012275.80 0000924 00245.00 2007-10-25ASDFRESS,POIU S 000000000000015.52 000000000000000.00 CBB00010000000906 Code:
QWERTYUI098765432112345 QWIUYTUI098765432112345 CDXRTYUI098765432112345 The above info in file1 is all in a single line. Now i want to take the lines one by one in file1 and find if there is matching record in file 2 and if it finds it should replace and most important is it should not disturb the other info in the particular line.( Previous paste command is working but it is disturbing the spaces and it is removing those spaces in file 2. Please give me the solution. Thanks in advance. Last edited by vgersh99; 02-08-2008 at 01:32 AM. Reason: vB Codes |
|
#5
|
|||
|
|||
|
Unix File operations
Here also in file 2 , there is 40 spaces in between the email id and the next number. while copying it is not correctly pasted.
Thanks |
|
#7
|
|||
|
|||
|
Unix File operations
how to use this vb codes??
|
|||
| Google The UNIX and Linux Forums |