Convert to single line for each section [duplicate]











up vote
-3
down vote

favorite













This question already has an answer here:




  • How can I replace end line with fixed text when the next line begins with a defined set of characters?

    6 answers




I have data as shown below. I want to convert it to a single line
for each part (starting with #).



I want it as:



#6536  -  NEW [R]  -  *NONE*.
communicationFailureEvent - SITE - MSC_MR1_B02_KBN1(55/JANPAT4-1/D311-CE/DEL-ODM_L): 55 SITE - 15/04/2018 11:21:55.
[0] Last RSL Link Failure - FMIC - Critical -/-.
Config Tag 1

#7811 - NEW [R] - *NONE*.
communicationFailureEvent - SITE - MSC_MR1_B17_KB3(8/PNB_3G/D323-CE/DEL-IBM_L): 8 SITE - 25/04/2018 15:52:04.
[0] Last RSL Link Failure - FMIC - Critical -/-.
Config Tag 3ed1

#5569 - NEW [R] - *NONE*.
communicationFailureEvent - SITE - MSC_MR1_B22_GZBD2(49/TRISHUL-APT_3G/D441-GZ/GZB): 49 SITE - 23/06/2018 08:28:54.
[0] Last RSL Link Failure - FMIC - Critical -/-.
Config Tag 86d217

#3369 - NEW [R] - *NONE*.
communicationFailureEvent - SITE - MSC_KB1_B13_KB2(19/KIRTI-NAGAR_3G/D342-EA/DEL): 19 SITE - 30/06/2018 11:06:41.
[0] Last RSL Link Failure - FMIC - Critical -/-.
Config Tag 82cb8c

#1641 - NEW [R] - *NONE*.
communicationFailureEvent - SITE - MSC_KB1_B06_KB1(27/MOTINAGAR-NW_3G/D342-EA/DEL): 27 SITE - 30/06/2018 12:08:59.
[0] Last RSL Link Failure - FMIC - Critical -/-.
Config Tag 8540f6
===========================================================
#6536 NEW [R] *NONE*. communicationFailureEvent SITE MSC_MR1_B02_KBN1(55/JANPAT4-1/D311-CE/DEL-ODM_L): 55 SITE 15/04/2018 11:21:55. [0] Last RSL Link Failure FMIC Critical -/-. Config Tag 1









share|improve this question















marked as duplicate by harrymc, slhck, Kamil Maciorowski, Burgi, fixer1234 Nov 23 at 7:36


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • What have you tried so far? Please update your question with your working. superuser.com/help/how-to-ask
    – spikey_richie
    Nov 22 at 13:54












  • Formatting is really catastrophic, please change it
    – davidbaumann
    Nov 22 at 14:06















up vote
-3
down vote

favorite













This question already has an answer here:




  • How can I replace end line with fixed text when the next line begins with a defined set of characters?

    6 answers




I have data as shown below. I want to convert it to a single line
for each part (starting with #).



I want it as:



#6536  -  NEW [R]  -  *NONE*.
communicationFailureEvent - SITE - MSC_MR1_B02_KBN1(55/JANPAT4-1/D311-CE/DEL-ODM_L): 55 SITE - 15/04/2018 11:21:55.
[0] Last RSL Link Failure - FMIC - Critical -/-.
Config Tag 1

#7811 - NEW [R] - *NONE*.
communicationFailureEvent - SITE - MSC_MR1_B17_KB3(8/PNB_3G/D323-CE/DEL-IBM_L): 8 SITE - 25/04/2018 15:52:04.
[0] Last RSL Link Failure - FMIC - Critical -/-.
Config Tag 3ed1

#5569 - NEW [R] - *NONE*.
communicationFailureEvent - SITE - MSC_MR1_B22_GZBD2(49/TRISHUL-APT_3G/D441-GZ/GZB): 49 SITE - 23/06/2018 08:28:54.
[0] Last RSL Link Failure - FMIC - Critical -/-.
Config Tag 86d217

#3369 - NEW [R] - *NONE*.
communicationFailureEvent - SITE - MSC_KB1_B13_KB2(19/KIRTI-NAGAR_3G/D342-EA/DEL): 19 SITE - 30/06/2018 11:06:41.
[0] Last RSL Link Failure - FMIC - Critical -/-.
Config Tag 82cb8c

#1641 - NEW [R] - *NONE*.
communicationFailureEvent - SITE - MSC_KB1_B06_KB1(27/MOTINAGAR-NW_3G/D342-EA/DEL): 27 SITE - 30/06/2018 12:08:59.
[0] Last RSL Link Failure - FMIC - Critical -/-.
Config Tag 8540f6
===========================================================
#6536 NEW [R] *NONE*. communicationFailureEvent SITE MSC_MR1_B02_KBN1(55/JANPAT4-1/D311-CE/DEL-ODM_L): 55 SITE 15/04/2018 11:21:55. [0] Last RSL Link Failure FMIC Critical -/-. Config Tag 1









share|improve this question















marked as duplicate by harrymc, slhck, Kamil Maciorowski, Burgi, fixer1234 Nov 23 at 7:36


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • What have you tried so far? Please update your question with your working. superuser.com/help/how-to-ask
    – spikey_richie
    Nov 22 at 13:54












  • Formatting is really catastrophic, please change it
    – davidbaumann
    Nov 22 at 14:06













up vote
-3
down vote

favorite









up vote
-3
down vote

favorite












This question already has an answer here:




  • How can I replace end line with fixed text when the next line begins with a defined set of characters?

    6 answers




I have data as shown below. I want to convert it to a single line
for each part (starting with #).



I want it as:



#6536  -  NEW [R]  -  *NONE*.
communicationFailureEvent - SITE - MSC_MR1_B02_KBN1(55/JANPAT4-1/D311-CE/DEL-ODM_L): 55 SITE - 15/04/2018 11:21:55.
[0] Last RSL Link Failure - FMIC - Critical -/-.
Config Tag 1

#7811 - NEW [R] - *NONE*.
communicationFailureEvent - SITE - MSC_MR1_B17_KB3(8/PNB_3G/D323-CE/DEL-IBM_L): 8 SITE - 25/04/2018 15:52:04.
[0] Last RSL Link Failure - FMIC - Critical -/-.
Config Tag 3ed1

#5569 - NEW [R] - *NONE*.
communicationFailureEvent - SITE - MSC_MR1_B22_GZBD2(49/TRISHUL-APT_3G/D441-GZ/GZB): 49 SITE - 23/06/2018 08:28:54.
[0] Last RSL Link Failure - FMIC - Critical -/-.
Config Tag 86d217

#3369 - NEW [R] - *NONE*.
communicationFailureEvent - SITE - MSC_KB1_B13_KB2(19/KIRTI-NAGAR_3G/D342-EA/DEL): 19 SITE - 30/06/2018 11:06:41.
[0] Last RSL Link Failure - FMIC - Critical -/-.
Config Tag 82cb8c

#1641 - NEW [R] - *NONE*.
communicationFailureEvent - SITE - MSC_KB1_B06_KB1(27/MOTINAGAR-NW_3G/D342-EA/DEL): 27 SITE - 30/06/2018 12:08:59.
[0] Last RSL Link Failure - FMIC - Critical -/-.
Config Tag 8540f6
===========================================================
#6536 NEW [R] *NONE*. communicationFailureEvent SITE MSC_MR1_B02_KBN1(55/JANPAT4-1/D311-CE/DEL-ODM_L): 55 SITE 15/04/2018 11:21:55. [0] Last RSL Link Failure FMIC Critical -/-. Config Tag 1









share|improve this question
















This question already has an answer here:




  • How can I replace end line with fixed text when the next line begins with a defined set of characters?

    6 answers




I have data as shown below. I want to convert it to a single line
for each part (starting with #).



I want it as:



#6536  -  NEW [R]  -  *NONE*.
communicationFailureEvent - SITE - MSC_MR1_B02_KBN1(55/JANPAT4-1/D311-CE/DEL-ODM_L): 55 SITE - 15/04/2018 11:21:55.
[0] Last RSL Link Failure - FMIC - Critical -/-.
Config Tag 1

#7811 - NEW [R] - *NONE*.
communicationFailureEvent - SITE - MSC_MR1_B17_KB3(8/PNB_3G/D323-CE/DEL-IBM_L): 8 SITE - 25/04/2018 15:52:04.
[0] Last RSL Link Failure - FMIC - Critical -/-.
Config Tag 3ed1

#5569 - NEW [R] - *NONE*.
communicationFailureEvent - SITE - MSC_MR1_B22_GZBD2(49/TRISHUL-APT_3G/D441-GZ/GZB): 49 SITE - 23/06/2018 08:28:54.
[0] Last RSL Link Failure - FMIC - Critical -/-.
Config Tag 86d217

#3369 - NEW [R] - *NONE*.
communicationFailureEvent - SITE - MSC_KB1_B13_KB2(19/KIRTI-NAGAR_3G/D342-EA/DEL): 19 SITE - 30/06/2018 11:06:41.
[0] Last RSL Link Failure - FMIC - Critical -/-.
Config Tag 82cb8c

#1641 - NEW [R] - *NONE*.
communicationFailureEvent - SITE - MSC_KB1_B06_KB1(27/MOTINAGAR-NW_3G/D342-EA/DEL): 27 SITE - 30/06/2018 12:08:59.
[0] Last RSL Link Failure - FMIC - Critical -/-.
Config Tag 8540f6
===========================================================
#6536 NEW [R] *NONE*. communicationFailureEvent SITE MSC_MR1_B02_KBN1(55/JANPAT4-1/D311-CE/DEL-ODM_L): 55 SITE 15/04/2018 11:21:55. [0] Last RSL Link Failure FMIC Critical -/-. Config Tag 1




This question already has an answer here:




  • How can I replace end line with fixed text when the next line begins with a defined set of characters?

    6 answers








linux






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 at 14:43









Blackwood

2,71761727




2,71761727










asked Nov 22 at 13:31









Vinod Kumar Yadav

1




1




marked as duplicate by harrymc, slhck, Kamil Maciorowski, Burgi, fixer1234 Nov 23 at 7:36


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by harrymc, slhck, Kamil Maciorowski, Burgi, fixer1234 Nov 23 at 7:36


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • What have you tried so far? Please update your question with your working. superuser.com/help/how-to-ask
    – spikey_richie
    Nov 22 at 13:54












  • Formatting is really catastrophic, please change it
    – davidbaumann
    Nov 22 at 14:06


















  • What have you tried so far? Please update your question with your working. superuser.com/help/how-to-ask
    – spikey_richie
    Nov 22 at 13:54












  • Formatting is really catastrophic, please change it
    – davidbaumann
    Nov 22 at 14:06
















What have you tried so far? Please update your question with your working. superuser.com/help/how-to-ask
– spikey_richie
Nov 22 at 13:54






What have you tried so far? Please update your question with your working. superuser.com/help/how-to-ask
– spikey_richie
Nov 22 at 13:54














Formatting is really catastrophic, please change it
– davidbaumann
Nov 22 at 14:06




Formatting is really catastrophic, please change it
– davidbaumann
Nov 22 at 14:06










1 Answer
1






active

oldest

votes

















up vote
0
down vote













Assuming it's always groups of 5 lines:



paste -s -d '    n' data




  • paste -s concatenates all lines in a single file, inserting delimiters if specified with -d

  • delimiters are a single characters, if there are several characters they are used in a round-robin fashion each time a line is appended






share|improve this answer





















  • This is your answer from under another question. The right thing to do is to close this one as a duplicate.
    – Kamil Maciorowski
    Nov 22 at 15:51










  • Relevant Meta: 1, 2.
    – Kamil Maciorowski
    Nov 22 at 15:59


















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













Assuming it's always groups of 5 lines:



paste -s -d '    n' data




  • paste -s concatenates all lines in a single file, inserting delimiters if specified with -d

  • delimiters are a single characters, if there are several characters they are used in a round-robin fashion each time a line is appended






share|improve this answer





















  • This is your answer from under another question. The right thing to do is to close this one as a duplicate.
    – Kamil Maciorowski
    Nov 22 at 15:51










  • Relevant Meta: 1, 2.
    – Kamil Maciorowski
    Nov 22 at 15:59















up vote
0
down vote













Assuming it's always groups of 5 lines:



paste -s -d '    n' data




  • paste -s concatenates all lines in a single file, inserting delimiters if specified with -d

  • delimiters are a single characters, if there are several characters they are used in a round-robin fashion each time a line is appended






share|improve this answer





















  • This is your answer from under another question. The right thing to do is to close this one as a duplicate.
    – Kamil Maciorowski
    Nov 22 at 15:51










  • Relevant Meta: 1, 2.
    – Kamil Maciorowski
    Nov 22 at 15:59













up vote
0
down vote










up vote
0
down vote









Assuming it's always groups of 5 lines:



paste -s -d '    n' data




  • paste -s concatenates all lines in a single file, inserting delimiters if specified with -d

  • delimiters are a single characters, if there are several characters they are used in a round-robin fashion each time a line is appended






share|improve this answer












Assuming it's always groups of 5 lines:



paste -s -d '    n' data




  • paste -s concatenates all lines in a single file, inserting delimiters if specified with -d

  • delimiters are a single characters, if there are several characters they are used in a round-robin fashion each time a line is appended







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 22 at 15:49









xenoid

3,5433718




3,5433718












  • This is your answer from under another question. The right thing to do is to close this one as a duplicate.
    – Kamil Maciorowski
    Nov 22 at 15:51










  • Relevant Meta: 1, 2.
    – Kamil Maciorowski
    Nov 22 at 15:59


















  • This is your answer from under another question. The right thing to do is to close this one as a duplicate.
    – Kamil Maciorowski
    Nov 22 at 15:51










  • Relevant Meta: 1, 2.
    – Kamil Maciorowski
    Nov 22 at 15:59
















This is your answer from under another question. The right thing to do is to close this one as a duplicate.
– Kamil Maciorowski
Nov 22 at 15:51




This is your answer from under another question. The right thing to do is to close this one as a duplicate.
– Kamil Maciorowski
Nov 22 at 15:51












Relevant Meta: 1, 2.
– Kamil Maciorowski
Nov 22 at 15:59




Relevant Meta: 1, 2.
– Kamil Maciorowski
Nov 22 at 15:59



Popular posts from this blog

Сан-Квентин

Алькесар

Josef Freinademetz