The UNIX and Linux Forums  

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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Reading an Input file and searching for occurrences WIHOUT SED or AWK kartikkumar84@g Shell Programming and Scripting 2 05-08-2008 05:16 PM
Help reading an input file in KSH zilla30066 Shell Programming and Scripting 2 02-01-2007 03:45 AM
Script for reading an input file gzs553 Shell Programming and Scripting 1 10-17-2006 03:55 AM
Reading in data sets into arrays from an input file. sidamin810 Shell Programming and Scripting 5 07-06-2005 04:54 AM
reading from input nageshrc Shell Programming and Scripting 1 11-29-2001 03:15 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 10-17-2005
Registered User
 

Join Date: Oct 2005
Posts: 6
Reading Input from File and Duplicates Output

Greetings to all,

I would like to read input from a file and make duplications from it with Linux shell.

For e.g.

Input file
-----------
ABC
ABB
ABA
-------------------------------
Output file
------------
ABC
ABC
ABC

ABB
ABB
ABB

ABA
ABA
ABA
--------------------------
I am trying to build a table from this, any quick help will be appreciated.

Thank you.

cheers,
Reply With Quote
Forum Sponsor
  #2  
Old 10-17-2005
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,264
Code:
while read record
do
      echo "$record"
      echo "$record"
      echo "$record"
done < oldfile > newfile
Reply With Quote
  #3  
Old 10-17-2005
Registered User
 

Join Date: Oct 2005
Posts: 6
Hi Jim,

Lets say if I am to duplicate ABC for 200 times, how do I put it into a control loop.

Sorry to make you spoon fed, I am trying to help my friend who need a fast solution for her assignment.

Thanks a lot.

cheers,
Reply With Quote
  #4  
Old 10-17-2005
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,683
Quote:
Originally Posted by noelcantona
... am trying to help my friend who need a fast solution for her assignment.
Rules say

(6) Do not post classroom or homework problems.
Reply With Quote
  #5  
Old 10-18-2005
Registered User
 

Join Date: Oct 2005
Posts: 6
Hit my nickname 'noelcantona' in Google, from the hit you get, tell me whether I am looking for a quick solution for my homework.

My friend needs help. He received 4 excels file with 60k of lines everyday. He is lazy to look for another solution and doing the ctrl+c and ctrl+v way. Approximately 2 hours per file.

Initially this question is posted in sqlserver forum but he can't use sqlserver, so I am here. I pity him, thats why I am doing my first post here in unix.com.

My meaning of assignment here does not mean homework but job assignment.

cheers,
-NoeL-
Reply With Quote
  #6  
Old 10-18-2005
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,683
Look at the solutions provided in this thread - for command

vino
Reply With Quote
  #7  
Old 10-18-2005
Registered User
 

Join Date: Oct 2005
Posts: 6
Thank you for your quick response.
Appreciate that.

cheers,
-NoeL-
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:16 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0