Sponsored Content
Full Discussion: Combine two text files
Top Forums Shell Programming and Scripting Combine two text files Post 302955239 by Corona688 on Tuesday 15th of September 2015 04:55:15 PM
Old 09-15-2015
I apologize for the bug, I had a variable naming conflict.

Code:
$ awk -f xml.awk -e '(TAGS ~ /^TEXT/) {
        printf("{{Text_ID=%s}}{{From=%s}}\n",ARGS["TEXT_ID"],ARGS["FROM"]);
        NN=$0 ; NN=gsub(/\n/, "",NN)+1;
        for(MM=1; MM<=NN; MM++) { RS="\n"; getline < "altinput.txt" ; RS="<" ; print } ; print "<ENDTEXT>" }' ORS="\n" OFS=" " text.xml
{{Text_ID=10155645315851111_10155645333076543}}{{From=460350337461111}}
This is the first text
<ENDTEXT>
{{Text_ID=10155645315851111_10155645317023456}}{{From=1626711840902323}}
This is the second text
<ENDTEXT>
{{Text_ID=10155645315851111_10155645320006543}}{{From=1481727095384343}}
This is the third text
If counted
GOT IT... ����
<ENDTEXT>
{{Text_ID=10155645315851111_10155645326222345}}{{From=411021195696789}}
This is the fourth text ........ This is different.
<ENDTEXT>

$


Last edited by Corona688; 09-16-2015 at 03:34 PM..
This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to combine text data into one line?

The following input needs to be manipulated as follows: INPUT from file or results of command: ============start: Medium identifier : a45c0213:47eb5485:0aec:0321 Medium label : SQL Disk_11516 Location : Protected : None ... (2 Replies)
Discussion started by: rcky_mntere
2 Replies

2. UNIX for Dummies Questions & Answers

combine text files into one file

I need to write a shell script which combines/joins 3 text files into one file. Do i put the txt files in the same folder as my script? Here is what i have: #!/bin/bash file1=$1 file2=$2 file3=$3 out="output.txt" count=0 if then echo "$(basename $0) file1 file2 file3" ... (3 Replies)
Discussion started by: zzthejimzz
3 Replies

3. Shell Programming and Scripting

How to Merge / combine / join / paste 2 text files side-by-side

I have 2 text files, both have one simple, single column. The 2 files might be the same length, or might not, and if not, it's unknown which one would be longer. For this example, file1 is longer: ---file1 Joe Bob Mary Sally Fred Elmer David ---file2 Tomato House Car... (3 Replies)
Discussion started by: cajunfries
3 Replies

4. Shell Programming and Scripting

how to combine 2 lines in same files based on any text

hi, I want to combine two lines in same file. If the line ends with '&' it should belongs to previous line only Here i am writing example. Ex1: line 1 : return abcdefgh& line 2 : ijklmnopqr& line 3 : stuvw& line 4 : xyz output should be line 1: return abcdefghijklmnopqrstuvwxyz ... (11 Replies)
Discussion started by: spc432
11 Replies

5. Shell Programming and Scripting

Combine Multiple text or csv files column-wise

Hi All I am trying to combine columns from multiple text files into a single file using paste command but the record length being unequal in the different files the data is running over to the closest empty cell on the left. Please see below. What can i do to resolve this ? File 1 File... (15 Replies)
Discussion started by: venky_ibm
15 Replies

6. UNIX for Dummies Questions & Answers

how to combine text files

how to combine text files in new file and be separated by commas : example: f1.txt 1 2 3 f2.txt x y z f3.txt m n o i need output to be fnew.txt 1,x,m (9 Replies)
Discussion started by: takyeldin
9 Replies

7. Shell Programming and Scripting

conditionally combine text from two files into one

Hi! I'm trying to take multiple text files (6), which have text on some lines but not others, and combine them. I'd also like to make the values in one column of some of the files (files 4-6) negative. I'm trying to write a short script (see below) as I have to do this with a large number of... (2 Replies)
Discussion started by: felix.echidna
2 Replies

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

9. Shell Programming and Scripting

Combine Two Text Files (PERMUTE)

Hello everybody, I would like to know how can I obtain this: There are two text files.....ffirst.txt and fsecond.txt ffirst.txt contains 5 lines (example): A B C D E fsecond.txt contains 10 lines (example): 1 2 3 4 5 6 (4 Replies)
Discussion started by: gandrinno1
4 Replies

10. UNIX for Beginners Questions & Answers

Automate splitting of files , scp files as each split completes and combine files on target server

i use the split command to split a one terabyte backup file into 10 chunks of 100 GB each. The files are split one after the other. While the files is being split, I will like to scp the files one after the other as soon as the previous one completes, from server A to Server B. Then on server B ,... (2 Replies)
Discussion started by: malaika
2 Replies
MooseX::Types::Combine(3pm)				User Contributed Perl Documentation			       MooseX::Types::Combine(3pm)

NAME
MooseX::Types::Combine - Combine type libraries for exporting VERSION
version 0.35 SYNOPSIS
package CombinedTypeLib; use base 'MooseX::Types::Combine'; __PACKAGE__->provide_types_from(qw/TypeLib1 TypeLib2/); package UserClass; use CombinedTypeLib qw/Type1 Type2 ... /; DESCRIPTION
Allows you to export types from multiple type libraries. Libraries on the right side of the type libs passed to "provide_types_from" take precedence over those on the left in case of conflicts. CLASS METHODS
provide_types_from Sets or returns a list of type libraries to re-export from. SEE ALSO
MooseX::Types LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as perl itself. AUTHOR
Robert "phaylon" Sedlacek <rs@474.at> COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Robert "phaylon" Sedlacek. 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-19 MooseX::Types::Combine(3pm)
All times are GMT -4. The time now is 07:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy