The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Linux Replicated High Availability Manager 1.4.4 (DRBD 8.2 based branch) iBot Software Releases - RSS News 0 08-29-2008 06:50 AM
Use records from one file to delete records in another file kenneth.mcbride UNIX for Dummies Questions & Answers 5 06-18-2008 02:36 PM
Linux Replicated High Availability Manager 1.4.2 (DRBD 8.2 based branch) iBot Software Releases - RSS News 0 04-15-2008 02:00 PM
Linux Replicated High Availability Manager 1.2.8 (Default branch) iBot Software Releases - RSS News 0 01-21-2008 09:00 PM
Count No of Records in File without counting Header and Trailer Records guiguy Shell Programming and Scripting 2 06-07-2007 12:15 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-12-2008
Russ Russ is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 2
How to replicated records using sed

I need to generate exactly 102 duplicates in a file using sed.

Here's an example of my input:
Grid-ref = 1, 148
Grid-ref = 1, 311
Grid-ref = 1, 428


I need:
Grid-ref = 1, 148
Grid-ref = 1, 148
Grid-ref = 1, 148
Grid-ref = 1, 148
... repeated 102 times, then
Grid-ref = 1, 311
Grid-ref = 1, 311
Grid-ref = 1, 311
... repeated 102 times, then record 3, etc.

Any ideas using either sed (preferably), awk or ksh?

thanks
  #2 (permalink)  
Old 11-12-2008
danmero danmero is offline Forum Advisor  
  
 

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 1,421
Code:
 awk '{for(i=1;i++<=v;)print}' v=102 file
  #3 (permalink)  
Old 11-12-2008
Russ Russ is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 2
You rock!
Much thanks.
Closed Thread

Bookmarks

Tags
duplicates

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:46 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0