Sponsored Content
Top Forums Shell Programming and Scripting how to combine 2 lines in same files based on any text Post 302331443 by zaxxon on Monday 6th of July 2009 08:04:07 AM
Old 07-06-2009
Did you ignore my answer? It does exactly what you asked now the 2nd time. Smilie I just forgot to add the word "return" in the first line but it doesn't matter generally and can be added. Result should be the same.

Edit:
Don't want to sound rude, just wondering.

Last edited by zaxxon; 07-06-2009 at 09:14 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Combine the lines based on particular pattern

Hi, I've a weird problem to be solved. Assume i have a file like this: 1. <timestamp> UID: 12345 <junk> DevID: V123 2. <timestamp>DevID: V123 <junk> DuID: VP 3. ... 4. .... 5. <timestamp> UID: 789 <junk> DevID: S456 6. <timestamp>DevID: S456 <junk> DuID: VP.... 7. ..... Say if i... (3 Replies)
Discussion started by: VenkataPrasad
3 Replies

2. Shell Programming and Scripting

How to combine two files based on fields?

I have two files which are as follows: File 1: 1 abc 250 2 pqr 300 3 xyz 100 File 2: 1 abc 230 2 pqr 700 3 xyz 500 Now I need output File, File 3as: S.No Name Count1 Count2 1 abc 250 230 2 pqr 300 700 3 xyz 100 500 NOTE: (13 Replies)
Discussion started by: karumudi7
13 Replies

3. Shell Programming and Scripting

combine lines from two files based on an if statement

I'm rather new to programming, and am attempting to combine lines from 2 files in a way that is way beyond my expertise - any help would be appreciated! I need to take a file (file1) and add columns to it from another file (file2). However, a line from file2 should only be added to a given line... (3 Replies)
Discussion started by: Cheri
3 Replies

4. Shell Programming and Scripting

Combine the lines from separate text files

Hi All, I have three separate text files which has only one line and i want to combine these lines in one text file which will have three lines. cat file1.txt abc cat file2.txt 1265 6589 1367 cat file3.txt 0.98 0.36 0.5 So, I want to see these three lines in the... (9 Replies)
Discussion started by: senayasma
9 Replies

5. Shell Programming and Scripting

Combine multiple lines in file based on specific field

Hi, I have an issue to combine multiple lines of a file. I have records as below. Fields are delimited by TAB. Each lines are ending with a new line char (\n) Input -------- ABC 123456 abcde 987 890456 7890 xyz ght gtuv ABC 5tyin 1234 789 ghty kuio ABC ghty jind 1234 678 ght ... (8 Replies)
Discussion started by: ratheesh2011
8 Replies

6. Shell Programming and Scripting

Extracting lines from text files in folder based on the numbers in another file

Hello, I have a file ff.txt that looks as follows *ABNA.txt 356 24 36 112 *AC24.txt 457 458 321 2 ABNA.txt and AC24.txt are the files in the folder named foo1. Based on the numbers in the ff.txt file, I want to extract the lines from the corresponding files in the foo1 folder and... (2 Replies)
Discussion started by: mohamad
2 Replies

7. Shell Programming and Scripting

Combine 3 files based on a pattern

HI, I have 3 files that contain the following information (sql output from Oracle database stored in a txt file): File1.txt : alter table "SYS"."INT_COST_PRICE" enable row movement; alter table "SYS"."INT_SOH" enable row movement; alter table "SYSMAN"."XX_ACI_SKURTP" enable row movement;... (6 Replies)
Discussion started by: rparavastu
6 Replies

8. Shell Programming and Scripting

Awk: Combine multiple lines based on number of fields

If a file has following kind of data, comma delimited 1,2,3,4 1 1 1,2,3,4 1,2 2 2,3,4 My required output must have only 4 columns with comma delimited 1,2,3,4 111,2,3,4 1,222,3,4 I have tried many awk command using ORS="" but couldnt progress (10 Replies)
Discussion started by: mdkm
10 Replies

9. Shell Programming and Scripting

awk to skip lines find text and add text based on number

I am trying to use awk skip each line with a ## or # and check each line after for STB= and if that value in greater than or = to 0.8, then at the end of line the text "STRAND BIAS" is written in else "GOOD". So in the file of 4 entries attached. awk tried: awk NR > "##"' "#" -F"STB="... (6 Replies)
Discussion started by: cmccabe
6 Replies

10. Shell Programming and Scripting

Combine and complete multiple CSV files based on 1 parameter

I have to create a new CSV file based on the value listed on the 3rd column from different CSV files. This is what I need: 1. I should substitute the first column from each file, excluding the headers, with the file name InputXX. 2. Then, I need to look for rows with 0 on the third column in... (7 Replies)
Discussion started by: Xterra
7 Replies
TAP::Parser::Result(3pm)				User Contributed Perl Documentation				  TAP::Parser::Result(3pm)

NAME
TAP::Parser::Result - Base class for TAP::Parser output objects VERSION
Version 3.25 SYNOPSIS
# abstract class - not meant to be used directly # see TAP::Parser::ResultFactory for preferred usage # directly: use TAP::Parser::Result; my $token = {...}; my $result = TAP::Parser::Result->new( $token ); DESCRIPTION This is a simple base class used by TAP::Parser to store objects that represent the current bit of test output data from TAP (usually a single line). Unless you're subclassing, you probably won't need to use this module directly. METHODS "new" # see TAP::Parser::ResultFactory for preferred usage # to use directly: my $result = TAP::Parser::Result->new($token); Returns an instance the appropriate class for the test token passed in. Boolean methods The following methods all return a boolean value and are to be overridden in the appropriate subclass. o "is_plan" Indicates whether or not this is the test plan line. 1..3 o "is_pragma" Indicates whether or not this is a pragma line. pragma +strict o "is_test" Indicates whether or not this is a test line. ok 1 Is OK! o "is_comment" Indicates whether or not this is a comment. # this is a comment o "is_bailout" Indicates whether or not this is bailout line. Bail out! We're out of dilithium crystals. o "is_version" Indicates whether or not this is a TAP version line. TAP version 4 o "is_unknown" Indicates whether or not the current line could be parsed. ... this line is junk ... o "is_yaml" Indicates whether or not this is a YAML chunk. "raw" print $result->raw; Returns the original line of text which was parsed. "type" my $type = $result->type; Returns the "type" of a token, such as "comment" or "test". "as_string" print $result->as_string; Prints a string representation of the token. This might not be the exact output, however. Tests will have test numbers added if not present, TODO and SKIP directives will be capitalized and, in general, things will be cleaned up. If you need the original text for the token, see the "raw" method. "is_ok" if ( $result->is_ok ) { ... } Reports whether or not a given result has passed. Anything which is not a test result returns true. This is merely provided as a convenient shortcut. "passed" Deprecated. Please use "is_ok" instead. "has_directive" if ( $result->has_directive ) { ... } Indicates whether or not the given result has a TODO or SKIP directive. "has_todo" if ( $result->has_todo ) { ... } Indicates whether or not the given result has a TODO directive. "has_skip" if ( $result->has_skip ) { ... } Indicates whether or not the given result has a SKIP directive. "set_directive" Set the directive associated with this token. Used internally to fake TODO tests. SUBCLASSING
Please see "SUBCLASSING" in TAP::Parser for a subclassing overview. Remember: if you want your subclass to be automatically used by the parser, you'll have to register it with "register_type" in TAP::Parser::ResultFactory. If you're creating a completely new result type, you'll probably need to subclass TAP::Parser::Grammar too, or else it'll never get used. Example package MyResult; use strict; use vars '@ISA'; @ISA = 'TAP::Parser::Result'; # register with the factory: TAP::Parser::ResultFactory->register_type( 'my_type' => __PACKAGE__ ); sub as_string { 'My results all look the same' } SEE ALSO
TAP::Object, TAP::Parser, TAP::Parser::ResultFactory, TAP::Parser::Result::Bailout, TAP::Parser::Result::Comment, TAP::Parser::Result::Plan, TAP::Parser::Result::Pragma, TAP::Parser::Result::Test, TAP::Parser::Result::Unknown, TAP::Parser::Result::Version, TAP::Parser::Result::YAML, perl v5.14.2 2012-06-05 TAP::Parser::Result(3pm)
All times are GMT -4. The time now is 06:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy