Computing.Net > Forums > Unix > Creating duplicate lines

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Creating duplicate lines

Reply to Message Icon

Name: hameds
Date: March 20, 2008 at 08:20:50 Pacific
OS: UNIX
CPU/Ram: n/a
Product: n/a
Comment:

Hi, I am in need of a regular expression that will create duplicate lines for any line starting with a certain character. For instance if i had:

asdfgh
aqwer
basdf
basdf

I want the output file to be:

asdfgh
asdfgh
aqwer
aqwer
basdf
basdf



Sponsored Link
Ads by Google

Response Number 1
Name: James Boothe
Date: March 20, 2008 at 09:20:08 Pacific
Reply:

sed /^a/p infile > outfile


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Creating duplicate lines

sed - delete duplicate lines www.computing.net/answers/unix/sed-delete-duplicate-lines/7507.html

to remove duplicate lines from file www.computing.net/answers/unix/to-remove-duplicate-lines-from-file/7011.html

How to delete duplicate lines ?? www.computing.net/answers/unix/how-to-delete-duplicate-lines-/8277.html