| Newsgroups |
gmane.editors.sed.user |
| Message-ID |
<[email protected]> |
if you are on bash, you can use something like
while IFS='-' read -r name number ;
do
sed -rn "/\/$name/s|$name|$name-$number|p" b ;
done < a
a and b are file A and file B.
On 22/02/17 22:37, Rachid Mokrani [email protected] [sed-users]
wrote:
> Hi,
>
>
> A little help would be appreciated to get the result below.
> Read input from A.txt compare with B.txt and replace/add lines to C.txt
>
>
>
>
> file A.txt :
>
>
> paul-112001
> paul-151998
> helen-101995
> mike-252001
> mike-171998
> mike-131999
> mike-151989
>
>
> file B.txt :
>
>
> paris/paul
> boston/paul
> london/paul
> san-francisco/mike
> san-francisco/helen
> san-francisco/dan
> rome/james
>
>
>
>
> Need result in file C.txt:
>
>
> paris/paul-112001
> paris/paul-151998
> boston/paul-112001
> boston/paul-151998
> london/paul-112001
> london/paul-151998
> san-francisco/mike-252001
> san-francisco/mike-171998
> san-francisco/mike-131999
> san-francisco/mike-151989
> san-francisco/helen-101995
> san-francisco/dan
> rome/james
>
>
>
>
> Many thanks.
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
>
> ------------------------------------
> Posted by: Rachid Mokrani <[email protected]>
> ------------------------------------
>