Sponsored Content
Full Discussion: concatenate lines in pairs
Top Forums Shell Programming and Scripting concatenate lines in pairs Post 302430362 by ygemici on Thursday 17th of June 2010 10:39:50 AM
Old 06-17-2010
Code:
# cat infile
/C=IT/O=INFN/OU=Personal Certificate/L=Napoli/CN=Some guy
/C=IT/O=INFN/CN=INFN CA
/O=Grid/O=NorduGrid/OU=uninett.no/CN=Another guy
/O=Grid/O=NorduGrid/CN=NorduGrid Certification Authority
/C=TW/O=AP/OU=GRID/CN=Someone else
/C=TW/O=AS/CN=Academia Sinica Grid Computing Certification Authority Mercury

Code:
# sed '/C=IT/N;s/\n/ / ;/O=Grid/N;s/\n/ / ;/C=TW/N;s/\n/ / ' infile
/C=IT/O=INFN/OU=Personal Certificate/L=Napoli/CN=Some guy /C=IT/O=INFN/CN=INFN CA
/O=Grid/O=NorduGrid/OU=uninett.no/CN=Another guy /O=Grid/O=NorduGrid/CN=NorduGrid Certification Authority
/C=TW/O=AP/OU=GRID/CN=Someone else /C=TW/O=AS/CN=Academia Sinica Grid Computing Certification Authority Mercury


Last edited by ygemici; 06-17-2010 at 12:05 PM..
This User Gave Thanks to ygemici For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

reading lines in pairs from file in ksh

I need to read pairs of lines from a file and compare them. We can assume that the number of lines in the file is even. Can i do it in korn shell? (4 Replies)
Discussion started by: ytokar
4 Replies

2. UNIX Desktop Questions & Answers

How to concatenate consecutive lines

I have a few lines like -- feature 1, subfeat 0, type 3, subtype 1, value 0, -- feature 1, subfeat 0, type 1, subtype 1, value 0, I would like to concatenate the... (1 Reply)
Discussion started by: shivi707
1 Replies

3. Shell Programming and Scripting

Concatenate two lines in one

Does anyone know a way I can fix my file below where it has lines that are cut? Just like the (notice the space before ms,c=PH).. dn: cn=english,ou=Messaging,ou=lang,o=subject,t=j ms,c=PH which should be dn: cn=english,ou=Messaging,ou=lang,o=subject,t=jms,c=PH The whole text file... (5 Replies)
Discussion started by: Orbix
5 Replies

4. Shell Programming and Scripting

Concatenate lines between lines starting with a specific pattern

Hi, I have a file such as: --- >contig00001 length=35524 numreads=2944 gACGCCGCGCGCCGCGGCCAGGGCTGGCCCA CAGGCCGCGCGGCGTCGGCTGGCTGAG >contig00002 length=4242 numreads=43423 ATGCCGAAGGTCCGCCTGGGGCTGG CGCCGGGAGCATGTAGCG --- I would like to concatenate the lines not starting with ">"... (9 Replies)
Discussion started by: s052866
9 Replies

5. Shell Programming and Scripting

How to swap order of pairs of lines?

This seems to be a question whose answer uses sed or awk. For a file like: a b c d e How to swap the order of the line pairs, to end up with: b a d c e All lines from the original file need to wind up in the output file. (8 Replies)
Discussion started by: rd5817
8 Replies

6. UNIX for Advanced & Expert Users

Parse (delimited string) key-value pairs in a column into separate lines

Hi experts, e.g. i/p data looks like 0000xm7zcNDIkP888vRqGv93xA7:176n00qql||9700005405552747,9700005405717924,9700005405733788|unidentified,unidentified,unidentified|| o/p data should like - row1: 0000xm7zcNDIkP888vRqGv93xA7:176n00qql||9700005405552747|unidentified ... (1 Reply)
Discussion started by: sumoka
1 Replies

7. Shell Programming and Scripting

File w/ many line pairs--how do I order based on 1st lines only?

I have a file in which the data is stored in pairs of lines. The first line (beginining with ">") is a header, the second line is a sequence. I would like to sort the file by species name. Desired output for the example file: I can use sort -t'_' -k2 to alphabetize headers in the... (1 Reply)
Discussion started by: pathunkathunk
1 Replies

8. UNIX for Dummies Questions & Answers

Concatenate three lines into one

Hi. I'm new to this forum. I am attempting to parse an Audit Log from Cognos/TM1, selecting only Event IDs of "client" which are found on the "start-tag" record. These Logs are in a pseudo-XML format but not a true XML format. I want to FTP an Audit Log File from the Cognos server to our UNIX... (7 Replies)
Discussion started by: FredAtArrow
7 Replies

9. Shell Programming and Scripting

Remove lines with duplicate pairs where AB is equal to BA

I have a file with four columns like dmn10003t1 PF00001 PF00022 dmn12390t1 dmn10008t1 PF00069 PF00027 dmn9781t1 dmn10008t1 PF00068 PF00027 dmn9781t1 dmn10008t1 PF00069 PF00069 dmn9781t1 dmn12390t1 PF00069 PF00076 dmn10003t1 I want to create a new file by comparing the repeated word pairs... (2 Replies)
Discussion started by: sammy777
2 Replies

10. UNIX for Dummies Questions & Answers

Concatenate files by pairs

Hi, I would like to batch concatenate files by pairs. I have quite a few of them so I would not like to do that pair by pair separately. the names of the file is of the type: file1.fastq newfile1_new.fastq file2.fastq newfile2_new.fastq and so on... I would like to concatenate file1... (2 Replies)
Discussion started by: jawad
2 Replies
SGE_QSTAT(5)						   Sun Grid Engine File Formats 					      SGE_QSTAT(5)

NAME
sge_qstat - Sun Grid Engine default qstat file format DESCRIPTION
sge_qstat defines the command line switches that will be used by qstat by default. If available, the default sge_qstat file is read and processed by qstat(1). There is a cluster global and a user private sge_qstat file. The user private file has the highest precedence and is followed by the clus- ter global sge_qstat file. Command line switches used with qstat(1) override all switches contained in the user private or cluster global sge_qstat file. The format of the default files is: o The default sge_qstat file may contain an arbitrary number of lines. Blank lines and lines with a '#' sign at the first column are skipped. Each line not to be skipped may contain any qstat(1) option as described in the Sun Grid Engine Reference Manual. More than one option per line is allowed. EXAMPLES
The following is a simple example of a default sge_qstat file: ===================================================== # Just show me my own running and suspended jobs -s rs -u $user ===================================================== Having defined a default sge_qstat file like this and using qstat as follows: qstat has the same effect as if qstat was executed with: qstat -s rs -u <current_user> FILES
<sge_root>/<cell>/common/sge_qstat global defaults file $HOME/.sge_qstatuser private defaults file SEE ALSO
sge_intro(1), qstat(1), Sun Grid Engine Installation and Administration Guide COPYRIGHT
See sge_intro(1) for a full statement of rights and permissions. SGE 6.2u5 $Date$ SGE_QSTAT(5)
All times are GMT -4. The time now is 07:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy