how to replace paste utility with sed/awk


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to replace paste utility with sed/awk
# 1  
Old 10-28-2005
how to replace paste utility with sed/awk

hi

I have two file that I would like to paste line by line. I use to use paste for this. But my current platform will not have paste utility. Could anyone please suggest how I it can be done using sed,awk or even simple bourne shell scripts?


Thanks
Sabina
# 2  
Old 10-28-2005
Code:
nawk '{
   FNR == NR { first[FNR]=$0; next }
   { print $0, (FNR in first) ? first[FNR] : "" }
}' file1 file2

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace my perl with awk or sed

My code below will print only the email address from all lines. I want to convert it with sed or awk.. also what if i just want to find only filenames. cat LIS_EMAIL | perl -wne'while(/+@+\w+/g){print "$&\n"}' Hoping to extract the filename such us .exe, .bin. From file that has scrambled... (8 Replies)
Discussion started by: invinzin21
8 Replies

2. UNIX for Beginners Questions & Answers

Replace using sed or awk

Hi, Need a help to replace a word if a pattern is found between the delimiters preferably using SED or AWK. below is the sample file that iam dealing with, need to match pattern 'application' if found replace the whole word between the delimiters and also print the lines that don't match.... (1 Reply)
Discussion started by: tech_frk
1 Replies

3. Shell Programming and Scripting

Use sed/awk to do like copy and paste

I have rrd file which is have the gaps and I want to fill it out with some value , I've got 10 NaN record and I try to populate data from 10 records be for NaN to change instead of NaN :( <!-- 2016-05-19 14:10:00 CST / 1463638200 -->... (11 Replies)
Discussion started by: boobytrap
11 Replies

4. Shell Programming and Scripting

replace using pattern using awk or sed

I have file file_1.txt which contains: file_1.txt <tr> 1 MAIL # 1 TO src_1 </tr> <tr><td class="hcol">col_id</td> <td class="hcol">test_dt</td> <td class="hcol">user_type</td> <td class="hcol">ct</td></tr> <tr><td class="bcol">1</td> <td class="bcol">2012-09-20</td> <td class="bcol">a</td>... (2 Replies)
Discussion started by: sol_nov
2 Replies

5. Shell Programming and Scripting

Using a combination of sort/cut/grep/awk/join/paste/sed

I have a file and need to only select users that have a shell of “/bin/bash” in the line using awk or sed please help (4 Replies)
Discussion started by: boyboy1212
4 Replies

6. UNIX for Dummies Questions & Answers

replace 0.00 with awk/sed

Hi I have a problem when i use awk or sed to replace characters in file. For example when I want to replace line like this : 00000O120100512 1.70 1.59 0.00 +7.280 I want to get a new line : 0000000O120100512 1.70 1.59 13.56 +7.280 In ksh : awk... (1 Reply)
Discussion started by: Artur
1 Replies

7. Shell Programming and Scripting

Sed help to replace and then awk

Sed help echo "(200 rows affected)" | sed -e '/\(//p' | sed -e '/\)//p' | awk '{print $1}' I want output as "200" Please help me correct (2 Replies)
Discussion started by: pinnacle
2 Replies

8. Shell Programming and Scripting

Replace tr/sed with awk

There is a service that runs that we call multi-streaming that calls a shell script multiple times simultaneously. In this shell script is the following line: tr '\r' '\n' < $POLLFILE.OUT | sed '/0000000000000016000A/d' > $POLLFILE When I run this manually it produces the desired results, but... (6 Replies)
Discussion started by: philplasma
6 Replies

9. UNIX for Dummies Questions & Answers

sed utility to replace /307 with comma

Hi, I have a requirement to replace '/307' with comma ',' . for e.g. : $ cat dm.dat ------------- decimdal("\307") acct $echo $l \307 $echo $k , $sed -e "s/$l/$k/" dm.dat > dm1.dat sed: Function s/\307/,/ cannot be parsed. I want dm1.dat to be : $ cat dm1.dat (1 Reply)
Discussion started by: obedkhan
1 Replies

10. UNIX for Dummies Questions & Answers

awk or sed or paste

i have a file and i need the text to line up currently the file looks like so job scheduled complete 12 12:00 wendsday 13 1:00 wednsday its a text file but not sure how to manipulate the file for it to line up (3 Replies)
Discussion started by: leprichaun
3 Replies
Login or Register to Ask a Question