|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Paste command formatting
Hi, I was trying to concatenate some files using paste command along with some formatting but getting stuck. The problem is: Code:
cat 1.txt A Code:
cat 2.txt B C Code:
cat3.txt D E Code:
cat 4.txt G H I Code:
paste -d "%" 2.txt 3.txt > 5.txt B%D C%E Code:
paste -d "%" 1.txt 5.txt 4.txt A%B%D%G %C%E%H %%I but Expected Output Code:
A%B%D%G %C%E%H %%%I problem is the number of lines present in the file. with absence of number of fields, the percentage sign during concatenation should vary accordingly. This is just a scenario. Please help. Regards Abhinav Last edited by Scrutinizer; 12-26-2012 at 05:21 AM.. Reason: code tags |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
There should be only to 2 percent signs on the 3rd row, the extra % sign on the two rows above are part of the input file (they stem from a previous paste operation...)
|
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Yes, what you are saying is correct.
The output of command will provide the output in that way only. But we need the output to be in the form as shown in expected output. Is there a way to format the output given by paste command to give the output as expected output. May be using awk.. but dont know how. |
|
#4
|
||||
|
||||
|
But what would be the criterion? The percentage signs introduced by the past command are related to the number of input files, for example Code:
paste -d% [1234].txt A%B%D%G %C%E%H %%%I So just leave out the intermediate file Last edited by Scrutinizer; 12-26-2012 at 05:51 AM.. |
| The Following User Says Thank You to Scrutinizer For This Useful Post: | ||
abhi1988sri (01-01-2013) | ||
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
but thats just the scenario i.e. file names 1,2,3,4...
files names are different , how to handle the formatting with this? |
| Sponsored Links | |
|
|
#6
|
||||
|
||||
|
paste
Hi, Just give your all file names in one instance, Code:
paste -d"%" file1 file2 file3 file4 Cheers, Ranga
|
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Paste command - question | jakSun8 | Shell Programming and Scripting | 3 | 02-13-2012 10:31 PM |
| Can't paste in command line. | louboulos | Shell Programming and Scripting | 8 | 12-19-2011 10:25 AM |
| paste command | repinementer | UNIX for Dummies Questions & Answers | 1 | 09-23-2009 07:35 AM |
| How to feed the output from grep command to paste command | ks_reddy | Shell Programming and Scripting | 2 | 04-04-2009 03:47 AM |
| paste command | mariner | UNIX for Advanced & Expert Users | 5 | 03-04-2005 01:42 AM |
|
|