In a text file, if the first 25 characters in a line are a space, how can I append that line to the previous line until another line comes along that starts with an ASCII character in column one. Since it can't be displayed like that here, I've added a screenshot. In the original file, I have to remove the trailing spaces for each line first. That works, but I have no idea how to implement the rest. I would prefer the whole thing as a script (no Perl or similar)
Original file:
08/07/2023 09:02:07 ANR8592T Session 137576 connection is using protocol
TLSVI3, cipher specification TLS_AES_256_GCM_SHA384,
certificate TSM Self-Signed Certificate. (SESSION:
137576)
08/07/2023 09:02:07 ANR@B4OT Session 137576 started for administrator ADMIN
(WinNT) (SSL MU-SV-SPS1.de.bertrandt.net[192.168.171.56]-
:65234) on MU-SV-SPS1.de.bertrandt.net:1500. (SESSTON:
137576)
08/07/2023 09:02:07 ANR2017T Administrator ADMIN issued command: select
status from processes where process="NAS SnapMirror
Backup’ and status like 'WMU-SV-CL2%' (SESSION: 137576)
08/07/2023 09:02:07 ANR@46ST Session 137576 ended for administrator ADMIN
(WinNT). (SESSION: 137576)
08/07/2023 09:02:38 ANR8592T Session 137577 connection is using protocol
TLSVI3, cipher specification TLS_AES_256_GCM_SHA384,
certificate TSM Self-Signed Certificate. (SESSION:
137577)
08/07/2023 09:02:38 ANR@B4OT Session 137577 started for administrator ADMIN
(WinNT) (SSL MU-SV-SPS1.de.bertrandt.net[192.168.171.56]-
:65235) on MU-SV-SPS1.de.bertrandt.net:1560. (SESSTON:
137577)
08/07/2023 09:02:38 ANR2017T Administrator ADMIN issued command: select
node_name, filespace_name, BACKUP_START, BACKUP_END,
CAPACITY, PCT_UTIL from filespaces where node_name like
“MU-SV-CL2%" (SESSION: 137577)
08/07/2023 09:02:38 ANR@46ST Session 137577 ended for administrator ADMIN
(WinNT). (SESSION: 137577)
08/07/2023 09:02:38 ANR8592T Session 137578 connection is using protocol
TLSVI3, cipher specification TLS_AES_256_GCM_SHA384,
certificate TSM Self-Signed Certificate. (SESSION:
137578)
08/07/2023 09:02:38 ANR@B4OT Session 137578 started for administrator ADMIN
(WinNT) (SSL MU-SV-SPS1.de.bertrandt.net[192.168.171.56]-
:65236) on MU-SV-SPS1.de.bertrandt.net:1560. (SESSTON:
137578)
Requested result:
08/07/2023 09:02:07 ANR8592T Session 137576 connection is using protocol TLSVI3, cipher specification TLS_AES_256_GCM_SHA384, certificate TSM Self-Signed Certificate. (SESSION: 137576)
08/07/2023 09:02:07 ANR@B4OT Session 137576 started for administrator ADMIN (WinNT) (SSL MU-SV-SPS1.de.bertrandt.net[192.168.171.56]- :65234) on MU-SV-SPS1.de.bertrandt.net:1500. (SESSTON: 137576)
08/07/2023 09:02:07 ANR2017T Administrator ADMIN issued command: select status from processes where process="NAS SnapMirror Backup’ and status like 'WMU-SV-CL2%' (SESSION: 137576) 08/07/2023 09:02:07 ANR@46ST Session 137576 ended for administrator ADMIN (WinNT). (SESSION: 137576)
08/07/2023 09:02:38 ANR8592T Session 137577 connection is using protocol TLSVI3, cipher specification TLS_AES_256_GCM_SHA384, certificate TSM Self-Signed Certificate. (SESSION: 137577)
08/07/2023 09:02:38 ANR@B4OT Session 137577 started for administrator ADMIN (WinNT) (SSL MU-SV-SPS1.de.bertrandt.net[192.168.171.56]- :65235) on MU-SV-SPS1.de.bertrandt.net:1560. (SESSTON: 137577)
08/07/2023 09:02:38 ANR2017T Administrator ADMIN issued command: select node_name, filespace_name, BACKUP_START, BACKUP_END, CAPACITY, PCT_UTIL from filespaces where node_name like “MU-SV-CL2%" (SESSION: 137577)
08/07/2023 09:02:38 ANR@46ST Session 137577 ended for administrator ADMIN (WinNT). (SESSION: 137577)
08/07/2023 09:02:38 ANR8592T Session 137578 connection is using protocol TLSVI3, cipher specification TLS_AES_256_GCM_SHA384, certificate TSM Self-Signed Certificate. (SESSION: 137578)
08/07/2023 09:02:38 ANR@B4OT Session 137578 started for administrator ADMIN (WinNT) (SSL MU-SV-SPS1.de.bertrandt.net[192.168.171.56]- :65236) on MU-SV-SPS1.de.bertrandt.net:1560. (SESSTON: 137578)
sed
,awk
,perl
, andraku
: https://unix.stackexchange.com/q/738723 – jubilatious1 Aug 17 '23 at 05:04