Sponsored Content
Special Forums UNIX Desktop Questions & Answers append a line to the last line in a file Post 302112388 by subhrap.das on Wednesday 28th of March 2007 01:46:41 AM
Old 03-28-2007
append a line to the last line in a file

Suppose i have a file "xyz.txt" which contains

abcdef
ghijklm
nop



Now in want to add "qrst" to the last line such that the file becomes

abcdef
ghijklm
nopqrst


P.S:The o/p i need is
abcdef
ghijklm
nopqrst (and not) nop
qrst
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to Append a Value to each line of the file

Hi, We have Multiple source files which has some data, I need a K shell script which will append number '1' as the last character to all the lines of the first file and then increments the value and appends '2' to all the lines to the next file and so on. For Example Incoming file 1 ... (11 Replies)
Discussion started by: dsshishya
11 Replies

2. Shell Programming and Scripting

Joining lines in reverse. append line 1 to line 2.

Hi I have used many times the various methods to append two lines together in a file. This time I want to append the 1st line to the second and repeat for the complete file.... an example This is the file owns the big brown dog joe owns the small black dog jim What I want is ... (7 Replies)
Discussion started by: dwalley
7 Replies

3. Shell Programming and Scripting

Append each line to next previous line in a file

Hi all, Please help me in providing sample code to append the following 4 lines in one row. Input : A1/EXT "BAPBSC10/07B/00" 523 090530 0115 RXOCF-430 HY1711 1 EXTERNAL ALARM DOOR ALARM Output should be : A1/EXT "BAPBSC10/07B/00" 523 090530 0115 ... (8 Replies)
Discussion started by: sudhakaryadav
8 Replies

4. Shell Programming and Scripting

shell script to read a line in gps receiver log file and append that line to new file

Hi, I have gps receiver log..its giving readings .like below Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GPSD,R=1 $GPGSV,3,1,11,08,16,328,40,11,36,127,00,28,33,283,39,20,11,165,00*71... (3 Replies)
Discussion started by: gudivada213
3 Replies

5. HP-UX

How to remove new line character and append new line character in a file?

Hi Experts, I have data coming in 4 columns and there are new line characters \n in between the data. I need to remove the new line characters in the middle of the row and keep the \n character at the end of the line. File is comma (,) seperated. Eg: ID,Client ,SNo,Rank 37,Airtel \n... (8 Replies)
Discussion started by: sasikari
8 Replies

6. Shell Programming and Scripting

Append next line to previous line when one pattern not found

Hi, I need help for below scenario.I have a flat file which is having records seperated by delimiters which will represent each record for oracle table.My Control file will consider each line as one record for that table. Some of the lines are aligned in two/three lines so that records are... (4 Replies)
Discussion started by: kannansr621
4 Replies

7. Shell Programming and Scripting

find a certain line and append text to the end of the line

After I create printer queues in AIX, I have to append a filter file location within that printers custom file. within lets say test_queue.txt I need to find the row that starts with :699 and then I need to append on the end the string /usr/local/bin/k_portrait.sh. Now I've gotten the sed... (2 Replies)
Discussion started by: peachclift
2 Replies

8. UNIX for Dummies Questions & Answers

How to remove fields space and append next line to previous line.?

awk 'BEGIN{FS = "Ç"} NR == 1 {p = $0; next} NF > 1 {print p; p = $0} NF <= 1 {p = (p " " $0)} END {print p}' input.txt > output.txt This is what the input data file looks like with broken lines Code: 29863 Ç890000000 Ç543209911 ÇCHNGOHG Ç000000001 Ç055 ... (4 Replies)
Discussion started by: cumeh1624
4 Replies

9. Shell Programming and Scripting

Append Next line with current Line bassed on condition

Hi, I have an XML file and I am tring to extract some data form it, after lot of data cleaning process, I ended up with an issue, and need your urgent support. my current input data in below format: <Node>xxxxxx <Node>yyyyy</Node> <Node>zzzzzz <Node>12345</node> I need... (9 Replies)
Discussion started by: rramkrishnas
9 Replies

10. Shell Programming and Scripting

Remove new line starting with a numeric value and append it to the previous line

Hi, i have a file with multiple entries. After some tests with sed i managed to get the file output as follows: lsn=X-LINK-IN0,apc=661:0,state=avail,avail/links=1/1, 00,2110597,2094790,0,81,529,75649011,56435363, lsn=TM1ITP1-AM1ITP1-LS,apc=500:0,state=avail,avail/links=1/1,... (5 Replies)
Discussion started by: nms
5 Replies
Pod::Elemental::Transformer::Gatherer(3pm)		User Contributed Perl Documentation		Pod::Elemental::Transformer::Gatherer(3pm)

NAME
Pod::Elemental::Transformer::Gatherer - gather related paragraphs under a shared header VERSION
version 0.102362 OVERVIEW
Like the Nester transformer, this Gatherer produces structure and containment in a Pod document. Unlike that Nester, it does not find top- level elements, but instead produces them. It looks for all elements matching the "gather_selector". They are removed from the node. In the place of the first found element, the "container" node is placed into the transformed node, and all the gathered elements are made children of the container. So, given this document: Document =head1 Foo =over 4 =item * xyzzy =item * abcdef =back =head1 Bar =over 4 =item * 1234 =item * 8765 =back ...and this nester... my $gatherer = Pod::Elemental::Transformer::Gatherer->new({ gather_selector => s_command( [ qw(over item back) ] ), container => Pod::Elemental::Element::Pod5::Command->new({ command => 'head1', content => "LISTS ", }), }); Then this: $nester->transform_node($document); Will result in this document: Document =head1 Foo =head1 LISTS =over 4 =item * xyzzy =item * abcdef =back =over 4 =item * 1234 =item * 8765 =back =head1 Bar ATTRIBUTES
gather_selector This is a coderef (a predicate) used to find the paragraphs to gather up. container This is a Pod::Elemental::Node that will be inserted into the node, containing all gathered elements. AUTHOR
Ricardo SIGNES <rjbs@cpan.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Ricardo SIGNES. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-05-05 Pod::Elemental::Transformer::Gatherer(3pm)
All times are GMT -4. The time now is 08:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy