nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

shell script to find and replace a line using a identifier

This is a discussion on shell script to find and replace a line using a identifier within the Shell scripting forums, part of the Development/Scripting category; Hi all im having trouble starting with a shell script, i hope someone here can help me i have 2 ...

Register free or login to your existing account and remove all advertisements.


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Linux answers from nixCraft.


Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-06-2009, 05:39 PM
Junior Member
User
 
Join Date: May 2009
OS: Centos
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
kenray is on a distinguished road
Default shell script to find and replace a line using a identifier

Hi all

im having trouble starting with a shell script, i hope someone here can help me

i have 2 files

file1:

404905.jpg 516167
404906.jpg 516168
404917.psd 516183
404947.pdf 516250

file2:

516250 /tmp/RecyclePoster18241.pdf
516167 /tmp/ReunionCardFINAL.jpg
516168 /tmp/MPP-3013594-05012009/ReunionBack.jpg
516183 /tmp/Stamp8x5.psd

my output would be like:

516167 /tmp/ReunionCardFINAL.jpg
516168 /tmp/MPP-3013594-05012009/ReunionBack.jpg
516183 /tmp/Stamp8x5.psd
516250 /tmp/RecyclePoster18241.pdf

note that file1 and file2 is not in particular order it could be
516183 404917.psd
404947.pdf 516250

and so on... although numbers 516183 and 404947 are unique which can be use as an identifier for the output

thanks in advance
Reply With Quote
  #2 (permalink)  
Old 05-11-2009, 11:09 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,674
Thanks: 11
Thanked 240 Times in 180 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

And how file1 and file2 are related to each other? I'm not able to see any relation between two in your output...?
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
To find and replace in text file nashtech Shell scripting 5 01-31-2010 06:32 AM
Shell script tp Log files last line kasimani Shell scripting 3 03-24-2009 03:25 PM
Shell script To find out who have account but are not logged in gsb1bee Shell scripting 4 03-21-2009 06:30 PM
Shell script to count number of lines in file specified by the second command-line seaman77 Shell scripting 1 03-16-2009 07:46 PM
writing a shell script to find out my shell name jaymob123 Shell scripting 1 10-08-2007 12:36 AM


All times are GMT +5.5. The time now is 01:43 AM.


Powered by vBulletin® Version 3.8.4 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2009 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38