Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to copy set of lines n times? Post 302764949 by nsuresh316 on Friday 1st of February 2013 07:07:43 AM
Old 02-01-2013
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
 

10 More Discussions You Might Find Interesting

1. AIX

grep to give how many times each lines were found

Lets say I have a file containing string patterns to be looked for inside a file. I would normaly do : grep -if MyFilePattern FiletoSearchInto if I use the -c it gives how many total lines it found out of my whole pattern file, but what if i want grep to report how many times it found each... (4 Replies)
Discussion started by: Browser_ice
4 Replies

2. Shell Programming and Scripting

Call single function multiple times diff set of parameters

Okay, not sure if it can be done, I would think it could be done and I'm just having a hard time with it. fun_close_wait(){ ipVar="${1} ${2}" portVar=`cat "${5}" | cut -d' ' -f 1` for ip in $ipVar do for port in $portVar do netstatVar=`netstat -n | grep... (4 Replies)
Discussion started by: cbo0485
4 Replies

3. Shell Programming and Scripting

Copy 1 file 5000 times and Rename each +1

Hi, Found lots of stuff that is close but no cigar... I have a file ie. a.txt, and I want to copy it to another directory 5000 times and call it: a1.txt a2.txt ... a5000.txt Struggling to put a loop together in this new world of AIX. please include full script for me to understand... (3 Replies)
Discussion started by: terry2009
3 Replies

4. Shell Programming and Scripting

Copy Column Multiple Times

Hello, I wonder if it my problem can be solved. Inside File1.txt, there are 3 columns. Inside File 2.txt, contain certain variable(in this case, only "3"). So I want to : (copy File 1 x Variable in File 2). Expected result are File 3.txt. Any help are really appreciated. File 1.txt -92.033... (4 Replies)
Discussion started by: guns
4 Replies

5. Shell Programming and Scripting

search and replace, when found, delete multiple lines, add new set of lines?

hey guys, I tried searching but most 'search and replace' questions are related to one liners. Say I have a file to be replaced that has the following: $ cat testing.txt TESTING AAA BBB CCC DDD EEE FFF GGG HHH ENDTESTING This is the input file: (3 Replies)
Discussion started by: DeuceLee
3 Replies

6. Shell Programming and Scripting

Copy n paste n times

I have one mainframe copy book where I want to copy n times depend on occurs which mention below. Example: Below highlighted row mention “occurs 2 times” so I need to copy 2 times till next label 10. C14992 10 FILLER PIC X(2835). 01 ... (7 Replies)
Discussion started by: srivalli
7 Replies

7. HP-UX

Getting the lines that contains a '/' N times(N given at runtime)

Hi all, The task I have sounds easy enough but my solution seems too much complicated and I would like some ideas/feedback on how to achieve the same goal with a more elegant solution on HP-UX B.11.23 (a grep with a regexp would be nice, I did not manage to do a working one :/ ) Here is my... (4 Replies)
Discussion started by: bibou25
4 Replies

8. Solaris

Set script to run during specific times

Hi all, I have this script which sends mail whenever the system is down. It works fine. Normally the system is down from 21 00 to 21 30 from Monday to Saturday and from 21 00 on Sunday to Monday 06 00 for maintenance. So I want the below script to run only when the system is up, i.e outside the... (2 Replies)
Discussion started by: frum
2 Replies

9. UNIX for Beginners Questions & Answers

Export lines that have first entry repeated 5 times or above

Dears i want to extract lines only that have first entry repeated 3 times or above , ex data : -bash-3.00$ cat INTCONT-IS.CSV M205-00-106_AMDRN:1-0-6-22,12-662-4833,intContact,2016-11-15 02:32:16,50 M205-00-106_AMDRN:1-0-23-17,12-616-0462,intContact,2016-11-15 02:32:23,50... (5 Replies)
Discussion started by: is2_egypt
5 Replies

10. Shell Programming and Scripting

Remove duplicate lines which has been repeated 4 times

Remove duplicate lines which has been repeated 4 times attached test.txt below command tried and not getting expect output. for i in `cat test.txt | uniq` do num=`cat test.txt | grep $i | wc -l` echo $i $num done test.txt ... (17 Replies)
Discussion started by: Kalia
17 Replies
compact(1)						      General Commands Manual							compact(1)

Name
       compact, uncompact, ccat - compress and uncompress files, and cat them

Syntax
       compact [name...]
       uncompact [name...]
       ccat [file...]

Description
       The  command compresses the named files using an adaptive Huffman code.	If no file names are given, the standard input is compacted to the
       standard output.  The command operates as an on-line algorithm.	Each time a byte is read, it is encoded immediately according to the  cur-
       rent  prefix  code.   This code is an optimal Huffman code for the set of frequencies seen so far.  It is unnecessary to prepend a decoding
       tree to the compressed file since the encoder and the decoder start in the same state and stay synchronized.  Furthermore, and can  operate
       as filters.  In particular,
	    ... | compact | uncompact | ...
       operates as a (very slow) no-op.

       When  an  argument file is given, it is compacted and the resulting file is placed in file.C; file is unlinked.	The first two bytes of the
       compacted file code the fact that the file is compacted.  This code is used to prohibit recompaction.

       The amount of compression to be expected depends on the type of file being compressed.  Typical values of compression are: Text (38%), Pas-
       cal Source (43%), C Source (36%) and Binary (19%).  These values are the percentages of file bytes reduced.

       The command restores the original file from a file compressed by If no file names are given, the standard input is uncompacted to the stan-
       dard output.

       The command cats the original file from a file compressed by without uncompressing the file.

       The command is present only for compatibility.  In general, the command runs faster and gives better compression.

Restrictions
       The last segment of the file name must contain fewer than thirteen characters to allow space for the appended '.C'.

Files
       compacted file created by compact, removed by uncompact

See Also
       compress(1)

																	compact(1)
All times are GMT -4. The time now is 01:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy