Sponsored Content
Top Forums Shell Programming and Scripting read file and print additional rows till current year Post 302265928 by vasuarjula on Monday 8th of December 2008 10:23:35 PM
Old 12-08-2008
read file and print additional rows till current year

Hi all
i have a file like
2006,1,2
2007,2,3
2008,3,4

I will read this and my output should be like
2006,1,2
2007,1,2
2008,1,2
2007,2,3
2008,2,3
2008,3,4

Giving the explanation, we will read the first line of the file and if the year any other than current year, we will print as many rows as needed till we reach current year for ex
if the first line of the file is like : 2004,3,4
then the output records of that record will be : 2004,3,4
2005,3,4
2006,3,4
2007,3,4
2008,3,4
i hope we can do this by using while, but how can i print all the fields of a singe record to output.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need to read a file and keep waiting till it satisfies some condition

In my script i am writing to a counter file the no of processes i had started, that is each time i start a process, i will increment the content of counter file and also when the process ends i will decrement the content of the file. after this i do some other activities, by now i want to... (1 Reply)
Discussion started by: senthilk615
1 Replies

2. Post Here to Contact Site Administrators and Moderators

how to read a file till it encounters a blank line

Hi , I want to read a file starting with "*" up to till it encounters a blank line and to redirect this output to a different file.Plz suggest how to write a script for this. e.g:- * PK Sent Email (11.23) CALYPSO 1243215 9116457 NEW TRAD FAILED Nov 23 2007 9:34AM OASYS: DPS:... (0 Replies)
Discussion started by: adityam
0 Replies

3. Shell Programming and Scripting

how to read a file till it encounters a blank line

Hi , I want to read a file starting with "*" up to till it encounters a blank line and to redirect this output to a different file.Plz suggest how to write a script for this. e.g:- * PK Sent Email (11.23) CALYPSO 1243215 9116457 NEW TRAD FAILED Nov 23 2007 9:34AM OASYS: DPS: SINGCORP invalid... (1 Reply)
Discussion started by: adityam
1 Replies

4. UNIX for Dummies Questions & Answers

how to read a file till it encounters a blank line

Hi , I want to read a file starting with "*" up to till it encounters a blank line and to redirect this output to a different file.Plz suggest how to write a script for this. e.g:- * PK Sent Email (11.23) CALYPSO 1243215 9116457 NEW TRAD FAILED Nov 23 2007 9:34AM OASYS: DPS: SINGCORP invalid... (1 Reply)
Discussion started by: adityam
1 Replies

5. Shell Programming and Scripting

How to print lines till till a pattern is matched in loop

Dear All I have a file like this 112534554 446538656 444695656 225696966 226569744 228787874 113536566 443533535 222564552 115464656 225445345 225533234 I want to cut the file into different parts where the first two columns are '11' . The first two columns will be either... (3 Replies)
Discussion started by: anoopvraj
3 Replies

6. Shell Programming and Scripting

Print file till specified line

Hi , I want to print file till line number 33 and stdout to different file. I have used cat -n <file name> which numbers the lines including blank line. now how can i stdout the first 33 lines in to new file. Regards newaix (6 Replies)
Discussion started by: newaix
6 Replies

7. UNIX for Dummies Questions & Answers

When reading a csv file, counter to read 20 lines and wait for minute then read next 20 till end

Hello All, i am a newbie and need some help when reading a csv file in a bourne shell script. I want to read 10 lines, then wait for a minute and then do a reading of another 10 lines and so on in the same way. I want to do this till the end of file. Any inputs are appreciated ... (3 Replies)
Discussion started by: victor.s
3 Replies

8. Shell Programming and Scripting

Read 4th column and print those many rows

Hi, My input file chr1 3217769 3217789 2952725-5 255 + chr1 3260455 3260475 2434087-6 255 - My desired output chr1 3217769 3217789 2952725-1 255 + chr1 3217769 3217789 2952725-2 255 + chr1 3217769 3217789 2952725-3 255 + chr1 3217769 3217789 2952725-4 255 +... (7 Replies)
Discussion started by: jacobs.smith
7 Replies

9. Shell Programming and Scripting

UNIX help to print 50 lines after every 3rd occurrence pattern till end of file

I need help with extract/print lines till stop pattern. This needs to happen after every 3rd occurrence of start pattern and continue till end of file. Consider below is an example of the log file. my start pattern will be every 3rd occurrence of ERROR_FILE_NOT_FOUND and stop pattern will be... (5 Replies)
Discussion started by: NSS
5 Replies

10. Shell Programming and Scripting

Read xml file till script finds separation and run again for next input and so on

Hi All, I have one query, I managed to run script with user inputs through command line or with 1 file. But I need to read a txt file/xml file in which user can mention multiple sets of answers and script should run for each set till it reach the EOF. Thanks in advance for example, the file... (3 Replies)
Discussion started by: rv_champ
3 Replies
DhMakePerl::Command::make(3pm)				User Contributed Perl Documentation			    DhMakePerl::Command::make(3pm)

NAME
DhMakePerl::Command::make - implementation of 'dh-make-perl make' SYNOPSIS
TO BE FILLED use DhMakePerl; my $foo = DhMakePerl->new(); ... METHODS
warning string ... In verbose mode, prints supplied arguments on STDERR, prepended with "W: " and suffixed with a new line. Does nothing in non-verbose mode. AUTHOR
dh-make-perl was created by Paolo Molaro. It is currently maintained by Gunnar Wolf and others, under the umbrella of the Debian Perl Group <debian-perl@lists.debian.org> BUGS
Please report any bugs or feature requests to the Debian Bug Tracking System (<http://bugs.debian.org/>, use dh-make-perl as package name) or to the debian-perl@lists.debian.org mailing list. SUPPORT
You can find documentation for this module with the perldoc command. perldoc DhMakePerl You can also look for information at: o Debian Bugtracking System http://bugs.debian.org/dh-make-perl <http://bugs.debian.org/dh-make-perl> COPYRIGHT &; LICENSE Copyright (C) 2000, 2001 Paolo Molaro <lupus@debian.org> Copyright (C) 2002, 2003, 2008 Ivan Kohler <ivan-debian@420.am> Copyright (C) 2003, 2004 Marc 'HE' Brockschmidt <he@debian.org> Copyright (C) 2005-2007 Gunnar Wolf <gwolf@debian.org> Copyright (C) 2006 Frank Lichtenheld <djpig@debian.org> Copyright (C) 2007-2010 Gregor Herrmann <gregoa@debian.org> Copyright (C) 2007,2008,2009,2010,2011 Damyan Ivanov <dmn@debian.org> Copyright (C) 2008, Roberto C. Sanchez <roberto@connexer.com> Copyright (C) 2009-2010, Salvatore Bonaccorso <carnil@debian.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. perl v5.14.2 2012-01-15 DhMakePerl::Command::make(3pm)
All times are GMT -4. The time now is 01:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy