Results 1 to 2 of 2

Thread: CSH Shell: How to copy set of lines n times?

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Location
    Chennai
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default CSH Shell: 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 OS Info : SunOS viper 5.9 Generic_117171-07 sun4u sparc SUNW,Sun-Fire-480R
    
    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

  2. #2
    Junior Member BoogY's Avatar
    Join Date
    Feb 2013
    Posts
    3
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Rep Power
    0

    Default

    Quote Originally Posted by nsuresh316 View Post
    I have a file with following data
    Code:
    A
    B
    C
    I would like to print like this n times(For eg:n times)
    You can just use a for loop and print the file as many times you want. Like this:

    Code:
    for i in {1..5} ; do echo hello ; done
    Sorry didn't see that you want that for csh .
    here is one :

    Code:
    @ i = 1
    while ($i <= 5)
      echo TOTO
      @ i += 1
    end
    Last edited by BoogY; 7th February 2013 at 06:14 PM.

  3. The Following User Says Thank You to BoogY For This Useful Post:

    nsuresh316 (8th February 2013)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 25th September 2011, 05:54 PM
  2. [Solved] UNIX / Linux: An expect shell script to copy ssh trusted keys
    By master-of-puppets in forum Shell scripting
    Replies: 4
    Last Post: 7th June 2011, 10:25 PM
  3. Shell Script(Echo as many times as stated)
    By jackjohnson12 in forum Shell scripting
    Replies: 4
    Last Post: 21st December 2010, 12:05 AM
  4. Remote FTP incremental copy shell script
    By manojbirari in forum Shell scripting
    Replies: 3
    Last Post: 7th November 2010, 09:19 PM
  5. Replies: 1
    Last Post: 16th March 2009, 07:46 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •