Copy text in file to every line in another file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Copy text in file to every line in another file
# 1  
Old 02-19-2015
Copy text in file to every line in another file

I have a document m1 which contains a single line of text which I want to copy to the beginning of all lines in another document. How do I do this??
# 2  
Old 02-19-2015
Any attempts from your side?
# 3  
Old 02-19-2015
Nothing so far, would it be simpler or easier to copy the first line of a file to the beginning of every line in the same file ?
# 4  
Old 02-19-2015
No, I guess, same effort for both requests.
# 5  
Old 02-21-2015
Moderator's Comments:
Mod Comment This thread is a duplicate of Fill csv entire column with content from another text file

I would normally close the newer thread in cases like this, but there is useful data in the other thread that is not present in this thread.

This thread is closed.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

awk to update file with partial matching line in another file and append text

In the awk below I am trying to cp and paste each matching line in f2 to $3 in f1 if $2 of f1 is in the line in f2 somewhere. There will always be a match (usually more then 1) and my actual data is much larger (several hundreds of lines) in both f1 and f2. When the line in f2 is pasted to $3 in... (4 Replies)
Discussion started by: cmccabe
4 Replies

2. Shell Programming and Scripting

Copy text and create new file

I have a directory with ~500 files that look like below. I need to copy each unique entry up until the second_ only once and put a .txt in place of the _. I am not quite sure how but have the below as a startThank you :). cp -u file1.txt "$(cat output.txt)" file1.txt ... (4 Replies)
Discussion started by: cmccabe
4 Replies

3. UNIX for Dummies Questions & Answers

Extracting lines from a text file based on another text file with line numbers

Hi, I am trying to extract lines from a text file given a text file containing line numbers to be extracted from the first file. How do I go about doing this? Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies

4. Shell Programming and Scripting

Copy some line and paste it after some line in same file

Hi, I want to know how I can copy line 6th to 10th and paste it after 17th line in same file. Thanks, Biplab (19 Replies)
Discussion started by: Biplab
19 Replies

5. UNIX for Dummies Questions & Answers

Hoe to copy selected strings from file into another text file

Hi Experts, I just want to copy some selected strings from a a file into a new .txt file . I am using below command to find the data now want to copy the search results into another .txt file please help me . find /Path -exec grep -w "filename1|filename1|filename1|" '{}' \;... (2 Replies)
Discussion started by: mumakhij
2 Replies

6. Shell Programming and Scripting

How to copy one file into another except some text

I have file input like- abc,"123",""123","123","123","123","123","123","123","123","123","123","123","123", abc,"123","123","123","123","123","123","123","123","123""123",abc etc Input file consists of 1000 records and i want to copy into final file except abc abc is at fixed position... (6 Replies)
Discussion started by: AhmedLakadkutta
6 Replies

7. Shell Programming and Scripting

How to copy text with ed to new file ?

Alright, so in ed i do a subsititution: ed file << 'HERE' s/.*h2.*>\(.*\)<.*/\1/p HERE This gives me my desired line: Errors found while checking this document as XHTML 1.0 Transitional! But how would i put this line in a temporary file ? (4 Replies)
Discussion started by: Bertieboy7
4 Replies

8. UNIX for Dummies Questions & Answers

How to copy entire file content into another file being in last line mode of vi ?

How to copy entire file content into another file being in last line mode of vi ? ---------- Post updated at 10:07 AM ---------- Previous update was at 09:56 AM ---------- Got it : :1,30w file.txt (1 Reply)
Discussion started by: presul
1 Replies

9. UNIX for Dummies Questions & Answers

Shell script to search for text in a file and copy file

Compete noob question.... I need a script to search through a directory and find files containing text string abcde1234 for example and then copy that file with that text string to another directory help please :eek: (9 Replies)
Discussion started by: imeadows
9 Replies

10. UNIX for Advanced & Expert Users

How to copy a string to a text file

I am using the following command to email a tex file as an attachment- cat mailtext.txt | elm -s "Subject" emailAddr where content of mailtext.txt is - "Body of email" This will attach foo.txt with the email. My problem is that the file foo.txt is ceated dynamically everytime with a... (5 Replies)
Discussion started by: hpuxlxboy
5 Replies
Login or Register to Ask a Question