Skip to main content
edited tags
Link
Gilles 'SO- stop being evil'
  • 865.5k
  • 205
  • 1.8k
  • 2.3k
deleted 56 characters in body
Source Link
slm
  • 379.8k
  • 127
  • 793
  • 897

I have two sample files like this:

  $ cat file1.txt 
   abc,sachin
   cat,kumar 

  $ cat file2.txt 
    xyz
    pressure

   $ cat file3 
     xyz,sachin
     pressure, kumar 
    

I want the first column of file1file1 to be replaced with file2file2.

I tried usingdoing something like this:

$ awk 'FNR==NR{a[NR]=$3;next}{$2=a[FNR]}1' file1 file2

I amI'm using solarisSolaris 10 and it didntdidn't appear to support me anythis. Any other suggestions ??

I have two sample files like this:

   cat file1.txt 
   abc,sachin
   cat,kumar 

   cat file2.txt 
    xyz
    pressure

    cat file3 
     xyz,sachin
     pressure, kumar 
    

I want the first column of file1 to be replaced with file2

I tried using like this:

awk 'FNR==NR{a[NR]=$3;next}{$2=a[FNR]}1' file1 file2

I am using solaris 10 and it didnt support me any other suggestions ??

I have two sample files like this:

$ cat file1
abc,sachin
cat,kumar 

$ cat file2
xyz
pressure

$ cat file3 
xyz,sachin
pressure, kumar 
    

I want the first column of file1 to be replaced with file2.

I tried doing something like this:

$ awk 'FNR==NR{a[NR]=$3;next}{$2=a[FNR]}1' file1 file2

I'm using Solaris 10 and it didn't appear to support this. Any other suggestions?

added 7 characters in body
Source Link
cuonglm
  • 158.2k
  • 41
  • 342
  • 420

hi iI have two sample files like this:

   cat file1.txt 
   abc,sachin
   cat,kumar 

   cat file2.txt 
    xyz
    pressure

    cat file3 
     xyz,sachin
     pressure, kumar 
    

iI want the first column of file1 to be replaced with file2

iI tried using like this awk 'FNR==NR{a[NR]=$3;next}{$2=a[FNR]}1' file1 file2.:

awk 'FNR==NR{a[NR]=$3;next}{$2=a[FNR]}1' file1 file2

I am using solaris 10 and it didnt support me any other suggestions ??

hi i have two sample files like this

   cat file1.txt 
   abc,sachin
   cat,kumar 

   cat file2.txt 
    xyz
    pressure

    cat file3 
     xyz,sachin
     pressure, kumar 
    

i want the first column of file1 to be replaced with file2

i tried using like this awk 'FNR==NR{a[NR]=$3;next}{$2=a[FNR]}1' file1 file2. I am using solaris 10 and it didnt support me any other suggestions ??

I have two sample files like this:

   cat file1.txt 
   abc,sachin
   cat,kumar 

   cat file2.txt 
    xyz
    pressure

    cat file3 
     xyz,sachin
     pressure, kumar 
    

I want the first column of file1 to be replaced with file2

I tried using like this:

awk 'FNR==NR{a[NR]=$3;next}{$2=a[FNR]}1' file1 file2

I am using solaris 10 and it didnt support me any other suggestions ??

Source Link
praveen
  • 91
  • 2
  • 3
Loading