LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-18-2012, 04:41 AM   #1
ingridsvensson
LQ Newbie
 
Registered: Sep 2012
Posts: 3

Rep: Reputation: Disabled
Talking Concatenating two files


Aloha

I am new to the linux environment and would like to pose this question:

File1.txt
---------
01659942.pdf:
01659943.pdf:x+2г42T0 AHDRB!9KH%+R)K@@!$
01659944.pdf:
01659945.pdf:

File2.txt
---------
<< /CreationDate (D:20060419121647-05'00') /Title (A 8-32 kbit/s Scalable Wideband Speech and Audio Coding Candidate for ITU-T G729EV Standardization) /Producer (PDFlib+PDI 6.0.3 \(COM/Win32\)) /ModDate (D:20060609142615-04')
<< /CreationDate (D:20060419121647-05'00') /Title (An Embedded Scalable Wideband Codec based on the GSM EFR Codec) /Producer (PDFlib+PDI 6.0.3 \(COM/Win32\)) /ModDate (D:20060609142616-04')
<< /CreationDate (D:20060419121647-05'00') /Title (Multiple Description Coding for Voice over IP using Sinusoidal Speech Coding) /Producer (PDFlib+PDI 6.0.3 \(COM/Win32\)) /ModDate (D:20060609142617-04')
<< /CreationDate (D:20060419121647-05'00') /Title (RESYNCHRONIZATION OF THE ADAPTIVE CODEBOOK IN A CONSTRAINED CELP CODEC AFTER A FRAME ERASURE) /Producer (PDFlib+PDI 6.0.3 \(COM/Win32\)) /ModDate (D:20060609142618-04')

Desired Resultant File (FileR.txt)
======================>
01659942.pdf:A 8-32 kbit/s Scalable Wideband Speech and Audio Coding Candidate for ITU-T G729EV Standardization
01659943.pdf:An Embedded Scalable Wideband Codec based on the GSM EFR Codec
01659944.pdf:Multiple Description Coding for Voice over IP using Sinusoidal Speech Coding
01659945.pdf:RESYNCHRONIZATION OF THE ADAPTIVE CODEBOOK IN A CONSTRAINED CELP CODEC AFTER A FRAME ERASURE

Instructions:
=============
Please cut and paste the contents of the two files in blank text files.

Question
========
I would like to know what is the command required to concatenate the first two files (looks like a vertical concatenation) in order to obtain the desired output file.

I have found a similar post but there is no explanation in that post that will help me extend the logic enumerated in that case to my question. So I shall really appreciate if the person clarifying would be a bit generous with his explanation.

Thanks,
Ingrid
 
Old 09-18-2012, 05:32 AM   #2
ynodelman
LQ Newbie
 
Registered: Sep 2008
Posts: 4

Rep: Reputation: 1
Ingrid,

You need to parse both files to temp once, containing just what you need and then "paste" them together:

cut -d":" -f1 <file1> > temp_file1
cut -d"(" -f3 <file2> >temp_file2
cut -d")" -f1 <temp_file2> >temp2_file2
paste -d":" temp_file1 temp2_file2 > result_file

PS: Try one by one command and see on the screen what you're getting
PPS: Always, always create a back-up.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Concatenating two files without creating a newline between them? linux_newestbie Linux - General 8 03-12-2010 08:16 AM
[SOLVED] Help with unpacking and concatenating multiple zip files SChipS Linux - Software 6 02-03-2010 05:13 AM
Mencoder Concatenating Movie Files Feeona Linux - Software 6 10-05-2009 01:43 PM
concatenating files s_siouris Linux - Software 4 05-30-2005 09:36 AM
concatenating strings to open files veilig Programming 1 11-10-2003 05:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration