Sponsored Content
Full Discussion: Awk Join multiple lines
Top Forums Shell Programming and Scripting Awk Join multiple lines Post 302094404 by ahmedwaseem2000 on Friday 27th of October 2006 11:04:59 AM
Old 10-27-2006
Thanks - Cheers!!!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

join on a file with multiple lines, fields

I've looked at the join command which is able to perform what I need on two rows with a common field, however if I have more than two rows I need to join all of them. Thus I have one file with multiple rows to be joined on an index number: 1 randomtext1 2 rtext2 2 rtext3 3 rtext4 3 rtext5... (5 Replies)
Discussion started by: crimper
5 Replies

2. UNIX for Dummies Questions & Answers

Join 2 files with multiple columns: awk/grep/join?

Hello, My apologies if this has been posted elsewhere, I have had a look at several threads but I am still confused how to use these functions. I have two files, each with 5 columns: File A: (tab-delimited) PDB CHAIN Start End Fragment 1avq A 171 176 awyfan 1avq A 172 177 wyfany 1c7k A 2 7... (3 Replies)
Discussion started by: InfoSeeker
3 Replies

3. Shell Programming and Scripting

How to use SED to join multiple lines?

Hi guys, anyone know how can i join multiples lines using sed till the end of a file and output to another file in a single line? The end of each line will be replaced with a special char "#". I am using the below SED command, however it seems to remove the last 2 lines. Also not all lines... (12 Replies)
Discussion started by: DrivesMeCrazy
12 Replies

4. Shell Programming and Scripting

Awk - join multiple files

Is it possible to join all the files with input1 based on 1st column? input1 a b c d e f input2 a b input3 a e input4 c (2 Replies)
Discussion started by: quincyjones
2 Replies

5. Shell Programming and Scripting

Join multiple lines

Hi I have a source file ( written i C ) where a funtion call is spread over multiple lines, for example : func( a, b, c ); I want this to be joined into one single line : func(a,b,c); How can this be done with awk and sed ? Regards. Hench (2 Replies)
Discussion started by: hench
2 Replies

6. Shell Programming and Scripting

Join common patterns in multiple lines into one line

Hi I have a file like 1 2 1 2 3 1 5 6 11 12 10 2 7 5 17 12 I would like to have an output as 1 2 3 5 6 10 7 11 12 17 any help would be highly appreciated Thanks (4 Replies)
Discussion started by: Harrisham
4 Replies

7. Shell Programming and Scripting

Join multiple lines from text file

Hi Guys, Could you please advise how to join multiple details lines into single row, with HEADER 1 as the record separator and comma(,) as the field separator. Input: HEADER 1, HEADER 2, HEADER 3, 11,22,33, COLUMN1,COLUMN2,COLUMN3, AA1, BB1, CC1, END: ABC HEADER 1, HEADER 2,... (3 Replies)
Discussion started by: budz26
3 Replies

8. Shell Programming and Scripting

Join lines using sed or awk

Hi, I have text file that looks like this: blabla bla PATTERN LINE1 LINE2 bla bla bla PATTERN LINE1 LINE2 bla PATTERN LINE1 LINE2 bla (9 Replies)
Discussion started by: hench
9 Replies

9. Shell Programming and Scripting

awk join lines based on keyword

Hello , I will need your help once again. I have the following file: cat file02.txt PATTERN XXX.YYY.ZZZ. 500 ROW01 aaa. 300 XS 14 ROW 45 29 AS XD.FD. PATTERN 500 ZZYN002 ROW gdf gsste ALT 267 fhhfe.ddgdg. PATTERN ERE.MAY. 280 PATTERRNTH 5000 rt.rt. ROW SO a 678 PATTERN... (2 Replies)
Discussion started by: alex2005
2 Replies

10. Shell Programming and Scripting

Join columns across multiple lines in a Text based on common column using BASH

Hello, I have a file with 2 columns ( tableName , ColumnName) delimited by a Pipe like below . File is sorted by ColumnName. Table1|Column1 Table2|Column1 Table5|Column1 Table3|Column2 Table2|Column2 Table4|Column3 Table2|Column3 Table2|Column4 Table5|Column4 Table2|Column5 From... (6 Replies)
Discussion started by: nv186000
6 Replies
IO::Stringy(3)						User Contributed Perl Documentation					    IO::Stringy(3)

NAME
IO-stringy - I/O on in-core objects like strings and arrays SYNOPSIS
IO:: ::AtomicFile adpO Write a file which is updated atomically ERYQ ::Lines bdpO I/O handle to read/write to array of lines ERYQ ::Scalar RdpO I/O handle to read/write to a string ERYQ ::ScalarArray RdpO I/O handle to read/write to array of scalars ERYQ ::Wrap RdpO Wrap old-style FHs in standard OO interface ERYQ ::WrapTie adpO Tie your handles & retain full OO interface ERYQ DESCRIPTION
This toolkit primarily provides modules for performing both traditional and object-oriented i/o) on things other than normal filehandles; in particular, IO::Scalar, IO::ScalarArray, and IO::Lines. In the more-traditional IO::Handle front, we have IO::AtomicFile which may be used to painlessly create files which are updated atomically. And in the "this-may-prove-useful" corner, we have IO::Wrap, whose exported wraphandle() function will clothe anything that's not a blessed object in an IO::Handle-like wrapper... so you can just use OO syntax and stop worrying about whether your function's caller handed you a string, a globref, or a FileHandle. WARNINGS
Perl's TIEHANDLE spec was incomplete prior to 5.005_57; it was missing support for "seek()", "tell()", and "eof()". Attempting to use these functions with an IO::Scalar, IO::ScalarArray, IO::Lines, etc. will not work prior to 5.005_57. None of the relevant methods will be invoked by Perl; and even worse, this kind of bug can lie dormant for a while. If you turn warnings on (via $^W or "perl -w"), and you see something like this... seek() on unopened file ...then you are probably trying to use one of these functions on one of our IO:: classes with an old Perl. The remedy is to simply use the OO version; e.g.: $SH->seek(0,0); ### GOOD: will work on any 5.005 seek($SH,0,0); ### WARNING: will only work on 5.005_57 and beyond INSTALLATION
Requirements As of version 2.x, this toolkit requires Perl 5.005 for the IO::Handle subclasses, and 5.005_57 or better is strongly recommended. See "WARNINGS" for details. Directions Most of you already know the drill... perl Makefile.PL make make test make install For everyone else out there... if you've never installed Perl code before, or you're trying to use this in an environment where your sysadmin or ISP won't let you do interesting things, relax: since this module contains no binary extensions, you can cheat. That means copying the directory tree under my "./lib" directory into someplace where your script can "see" it. For example, under Linux: cp -r IO-stringy-1.234/lib/* /path/to/my/perl/ Now, in your Perl code, do this: use lib "/path/to/my/perl"; use IO::Scalar; ### or whatever Ok, now you've been told. At this point, anyone who whines about not being given enough information gets an unflattering haiku written about them in the next change log. I'll do it. Don't think I won't. VERSION
$Id: Stringy.pm,v 1.3 2005/02/10 21:24:05 dfs Exp $ TO DO
(2000/08/02) Finalize $/ support Graham Barr submitted this patch half a year ago; Like a moron, I lost his message under a ton of others, and only now have the experimental implementation done. Will the sudden sensitivity to $/ hose anyone out there? I'm worried, so you have to enable it explicitly in 1.x. It will be on by default in 2.x, though only IO::Scalar has been implemented. (2001/08/08) Remove IO::WrapTie from new IO:: classes It's not needed. Backwards compatibility could be maintained by having new_tie() be identical to new(). Heck, I'll bet that IO::WrapTie should be reimplemented so the returned object is just like an IO::Scalar in its use of globrefs. CHANGE LOG
Version 2.110 (2005/02/10) Maintainership taken over by DSKOLL <dfs@roaringpenguin.com> Closed the following bugs at https://rt.cpan.org/NoAuth/Bugs.html?Dist=IO-stringy: 2208 IO::ScalarArray->getline does not return undef for EOF if undef($/) 7132 IO-stringy/Makefile.PL bug - name should be module name 11249 IO::Scalar flush shouldn't return undef 2172 $ (output record separator) not respected 8605 IO::InnerFile::seek() should return 1 on success 4798 *.html in lib/ 4369 Improvement: handling of fixed-size reads in IO::Scalar (Actually, bug 4369 was closed in Version 2.109) Version 2.109 (2003/12/21) IO::Scalar::getline now works with ref to int. Thanks to Dominique Quatravaux for this patch. Version 2.108 (2001/08/20) The terms-of-use have been placed in the distribution file "COPYING". Also, small documentation tweaks were made. Version 2.105 (2001/08/09) Added support for various seek() whences to IO::ScalarArray. Added support for consulting $/ in IO::Scalar and IO::ScalarArray. The old "use_RS()" is not even an option. Unsupported record separators will cause a croak(). Added a lot of regression tests to supoprt the above. Better on-line docs (hyperlinks to individual functions). Version 2.103 (2001/08/08) After sober consideration I have reimplemented IO::Scalar::print() so that it once again always seeks to the end of the string. Benchmarks show the new implementation to be just as fast as Juergen's contributed patch; until someone can convince me otherwise, the current, safer implementation stays. I thought more about giving IO::Scalar two separate handles, one for reading and one for writing, as suggested by Binkley. His points about what tell() and eof() return are, I think, show-stoppers for this feature. Even the manpages for stdio's fseek() seem to imply a single file position indicator, not two. So I think I will take this off the TO DO list. Remedy: you can always have two handles open on the same scalar, one which you only write to, and one which you only read from. That should give the same effect. Version 2.101 (2001/08/07) Alpha release. This is the initial release of the "IO::Scalar and friends are now subclasses of IO::Handle". I'm flinging it against the wall. Please tell me if the banana sticks. When it does, the banana will be called 2.2x. First off, many many thanks to Doug Wilson, who has provided an invaluable service by patching IO::Scalar and friends so that they (1) inherit from IO::Handle, (2) automatically tie themselves so that the "new()" objects can be used in native i/o constructs, and (3) doing it so that the whole damn thing passes its regression tests. As Doug knows, my globref Kung-Fu was not up to the task; he graciously provided the patches. This has earned him a seat at the Co-Authors table, and the right to have me address him as sensei. Performance of IO::Scalar::print() has been improved by as much as 2x for lots of little prints, with the cost of forcing those who print-then-seek-then-print to explicitly seek to end-of-string before printing again. Thanks to Juergen Zeller for this patch. Added the COPYING file, which had been missing from prior versions. Thanks to Albert Chin-A-Young for pointing this out. IO::Scalar consults $/ by default (1.x ignored it by default). Yes, I still need to support IO::ScalarArray. Version 1.221 (2001/08/07) I threatened in "INSTALLATION" to write an unflattering haiku about anyone who whined that I gave them insufficient information... but it turns out that I left out a crucial direction. D'OH! Thanks to David Beroff for the "patch" and the haiku... Enough info there? Here's unflattering haiku: Forgot the line, "make"! ;-) Version 1.220 (2001/04/03) Added untested SEEK, TELL, and EOF methods to IO::Scalar and IO::ScalarArray to support corresponding functions for tied filehandles: untested, because I'm still running 5.00556 and Perl is complaining about "tell() on unopened file". Thanks to Graham Barr for the suggestion. Removed not-fully-blank lines from modules; these were causing lots of POD-related warnings. Thanks to Nicolas Joly for the suggestion. Version 1.219 (2001/02/23) IO::Scalar objects can now be made sensitive to $/ . Pains were taken to keep the fast code fast while adding this feature. Cheers to Graham Barr for submitting his patch; jeers to me for losing his email for 6 months. Version 1.218 (2001/02/23) IO::Scalar has a new sysseek() method. Thanks again to Richard Jones. New "TO DO" section, because people who submit patches/ideas should at least know that they're in the system... and that I won't lose their stuff. Please read it. New entries in "AUTHOR". Please read those too. Version 1.216 (2000/09/28) IO::Scalar and IO::ScalarArray now inherit from IO::Handle. I thought I'd remembered a problem with this ages ago, related to the fact that these IO:: modules don't have "real" filehandles, but the problem apparently isn't surfacing now. If you suddenly encounter Perl warnings during global destruction (especially if you're using tied filehandles), then please let me know! Thanks to B. K. Oxley (binkley) for this. Nasty bug fixed in IO::Scalar::write(). Apparently, the offset and the number-of-bytes arguments were, for all practical purposes, reversed. You were okay if you did all your writing with print(), but boy was this a stupid bug! Thanks to Richard Jones for finding this one. For you, Rich, a double-length haiku: Newspaper headline typeset by dyslexic man loses urgency BABY EATS FISH is simply not equivalent to FISH EATS BABY New sysread and syswrite methods for IO::Scalar. Thanks again to Richard Jones for this. Version 1.215 (2000/09/05) Added 'bool' overload to '""' overload, so object always evaluates to true. (Whew. Glad I caught this before it went to CPAN.) Version 1.214 (2000/09/03) Evaluating an IO::Scalar in a string context now yields the underlying string. Thanks to B. K. Oxley (binkley) for this. Version 1.213 (2000/08/16) Minor documentation fixes. Version 1.212 (2000/06/02) Fixed IO::InnerFile incompatibility with Perl5.004. Thanks to many folks for reporting this. Version 1.210 (2000/04/17) Added flush() and other no-op methods. Thanks to Doru Petrescu for suggesting this. Version 1.209 (2000/03/17) Small bug fixes. Version 1.208 (2000/03/14) Incorporated a number of contributed patches and extensions, mostly related to speed hacks, support for "offset", and WRITE/CLOSE methods. Thanks to Richard Jones, Doru Petrescu, and many others. Version 1.206 (1999/04/18) Added creation of ./testout when Makefile.PL is run. Version 1.205 (1999/01/15) Verified for Perl5.005. Version 1.202 (1998/04/18) New IO::WrapTie and IO::AtomicFile added. Version 1.110 Added IO::WrapTie. Version 1.107 Added IO::Lines, and made some bug fixes to IO::ScalarArray. Also, added getc(). Version 1.105 No real changes; just upgraded IO::Wrap to have a $VERSION string. AUTHOR
Primary Maintainer David F. Skoll (dfs@roaringpenguin.com). Original Author Eryq (eryq@zeegee.com). President, ZeeGee Software Inc (http://www.zeegee.com). Co-Authors For all their bug reports and patch submissions, the following are officially recognized: Richard Jones B. K. Oxley (binkley) Doru Petrescu Doug Wilson (for picking up the ball I dropped, and doing tie() right) Go to http://www.zeegee.com for the latest downloads and on-line documentation for this module. Enjoy. Yell if it breaks. POD ERRORS
Hey! The above document had some coding errors, which are explained below: Around line 153: Expected text after =item, not a bullet Around line 157: Expected text after =item, not a bullet Around line 161: Expected text after =item, not a bullet Around line 165: Expected text after =item, not a bullet Around line 169: Expected text after =item, not a bullet Around line 173: Expected text after =item, not a bullet Around line 177: Expected text after =item, not a bullet perl v5.18.2 2005-02-10 IO::Stringy(3)
All times are GMT -4. The time now is 07:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy