|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to copy set of lines n times?
I have a file with following data Code:
A B C I would like to print like this n times(For eg:n times) Code:
A B C A B C A B C A B C A B C A B C . . . A B C Code:
My shell is csh Also this may be achieved using Code:
cat file file file .... file > newfile But i need other solution apart from using cat command |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Suresh,
you can try writing a loop and cat the file once in that loop. you can pass the number of times the loop should run as parameter. |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Code:
#!/bin/ksh export x=0 while [ $x -eq 0 ] do cat file done Last edited by Scrutinizer; 02-04-2013 at 02:28 AM.. Reason: code tags |
|
#4
|
|||
|
|||
|
Just change 5 to how many times you want to print... Code:
for ((i=1;i<=5;i++)) do cat file done > out_file |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| search and replace, when found, delete multiple lines, add new set of lines? | DeuceLee | Shell Programming and Scripting | 3 | 11-23-2011 03:39 PM |
| Copy Column Multiple Times | guns | Shell Programming and Scripting | 4 | 11-04-2011 02:21 AM |
| Copy 1 file 5000 times and Rename each +1 | terry2009 | Shell Programming and Scripting | 3 | 09-24-2009 12:29 PM |
| Call single function multiple times diff set of parameters | cbo0485 | Shell Programming and Scripting | 4 | 08-05-2009 08:32 AM |
| grep to give how many times each lines were found | Browser_ice | AIX | 4 | 12-14-2006 08:37 AM |
|
|