Find the answer to your Linux question:
Results 1 to 3 of 3
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 ...
  1. #1
    Just Joined!
    Join Date
    May 2009
    Posts
    3

    shell script to search and replace a line

    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 woulbe 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

  2. #2
    Linux Newbie
    Join Date
    Jul 2008
    Posts
    181
    If the order of fields were fixed, you could use "join".

  3. #3
    Just Joined!
    Join Date
    May 2009
    Posts
    3
    thanks for the reply,

    yes it could, thanks for that.. but how can i fix the order fields in that case

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...