line up horizontaly security identifier numbers
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
I have these security identifiers IDs (SIDs)
SID_1
S-1-2-12-347289564783285475
SID_2
S-1-2-12-312478290434839212
S-1-2-12-312748912347723432
S-1-2-12-123475184123489632
SID_3
SID_4
S-1-2-12-384721849326143123
S-1-2-12-324624783246712332
SID_5
SID_6
and I need to line them up horizontally so I can feed them to an algorithm which only accept the IDs in this form:
SID_1:S-1-2-12-347289564783285475
SID_2:S-1-2-12-312478290434839212:S-1-2-12-312748912347723432:S-1-2-12-123475184123489632
SID_3
SID_4:S-1-2-12-384721849326143123:S-1-2-12-324624783246712332
SID_5
SID_6
thank you for any help you may provide!
text-formatting
add a comment |Â
up vote
3
down vote
favorite
I have these security identifiers IDs (SIDs)
SID_1
S-1-2-12-347289564783285475
SID_2
S-1-2-12-312478290434839212
S-1-2-12-312748912347723432
S-1-2-12-123475184123489632
SID_3
SID_4
S-1-2-12-384721849326143123
S-1-2-12-324624783246712332
SID_5
SID_6
and I need to line them up horizontally so I can feed them to an algorithm which only accept the IDs in this form:
SID_1:S-1-2-12-347289564783285475
SID_2:S-1-2-12-312478290434839212:S-1-2-12-312748912347723432:S-1-2-12-123475184123489632
SID_3
SID_4:S-1-2-12-384721849326143123:S-1-2-12-324624783246712332
SID_5
SID_6
thank you for any help you may provide!
text-formatting
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I have these security identifiers IDs (SIDs)
SID_1
S-1-2-12-347289564783285475
SID_2
S-1-2-12-312478290434839212
S-1-2-12-312748912347723432
S-1-2-12-123475184123489632
SID_3
SID_4
S-1-2-12-384721849326143123
S-1-2-12-324624783246712332
SID_5
SID_6
and I need to line them up horizontally so I can feed them to an algorithm which only accept the IDs in this form:
SID_1:S-1-2-12-347289564783285475
SID_2:S-1-2-12-312478290434839212:S-1-2-12-312748912347723432:S-1-2-12-123475184123489632
SID_3
SID_4:S-1-2-12-384721849326143123:S-1-2-12-324624783246712332
SID_5
SID_6
thank you for any help you may provide!
text-formatting
I have these security identifiers IDs (SIDs)
SID_1
S-1-2-12-347289564783285475
SID_2
S-1-2-12-312478290434839212
S-1-2-12-312748912347723432
S-1-2-12-123475184123489632
SID_3
SID_4
S-1-2-12-384721849326143123
S-1-2-12-324624783246712332
SID_5
SID_6
and I need to line them up horizontally so I can feed them to an algorithm which only accept the IDs in this form:
SID_1:S-1-2-12-347289564783285475
SID_2:S-1-2-12-312478290434839212:S-1-2-12-312748912347723432:S-1-2-12-123475184123489632
SID_3
SID_4:S-1-2-12-384721849326143123:S-1-2-12-324624783246712332
SID_5
SID_6
thank you for any help you may provide!
text-formatting
text-formatting
edited 7 hours ago
Jeff Schaller
33.8k851113
33.8k851113
asked 7 hours ago
Kasper
374113
374113
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
6
down vote
accepted
with awk
:
awk '/^S-/s=s":"$1;nextsprint ss=$0ENDprint s' file
SID_1:S-1-2-12-347289564783285475
SID_2:S-1-2-12-312478290434839212:S-1-2-12-312748912347723432:S-1-2-12-123475184123489632
SID_3
SID_4:S-1-2-12-384721849326143123:S-1-2-12-324624783246712332
SID_5
SID_6
add a comment |Â
up vote
1
down vote
using sed
sed -i ':a;N;$!ba;s/nS-/:S-/g' file
SID_1:S-1-2-12-347289564783285475
SID_2:S-1-2-12-312478290434839212:S-1-2-12-312748912347723432:S-1-2-12-123475184123489632
SID_3
SID_4:S-1-2-12-384721849326143123:S-1-2-12-324624783246712332
SID_5
SID_6
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
accepted
with awk
:
awk '/^S-/s=s":"$1;nextsprint ss=$0ENDprint s' file
SID_1:S-1-2-12-347289564783285475
SID_2:S-1-2-12-312478290434839212:S-1-2-12-312748912347723432:S-1-2-12-123475184123489632
SID_3
SID_4:S-1-2-12-384721849326143123:S-1-2-12-324624783246712332
SID_5
SID_6
add a comment |Â
up vote
6
down vote
accepted
with awk
:
awk '/^S-/s=s":"$1;nextsprint ss=$0ENDprint s' file
SID_1:S-1-2-12-347289564783285475
SID_2:S-1-2-12-312478290434839212:S-1-2-12-312748912347723432:S-1-2-12-123475184123489632
SID_3
SID_4:S-1-2-12-384721849326143123:S-1-2-12-324624783246712332
SID_5
SID_6
add a comment |Â
up vote
6
down vote
accepted
up vote
6
down vote
accepted
with awk
:
awk '/^S-/s=s":"$1;nextsprint ss=$0ENDprint s' file
SID_1:S-1-2-12-347289564783285475
SID_2:S-1-2-12-312478290434839212:S-1-2-12-312748912347723432:S-1-2-12-123475184123489632
SID_3
SID_4:S-1-2-12-384721849326143123:S-1-2-12-324624783246712332
SID_5
SID_6
with awk
:
awk '/^S-/s=s":"$1;nextsprint ss=$0ENDprint s' file
SID_1:S-1-2-12-347289564783285475
SID_2:S-1-2-12-312478290434839212:S-1-2-12-312748912347723432:S-1-2-12-123475184123489632
SID_3
SID_4:S-1-2-12-384721849326143123:S-1-2-12-324624783246712332
SID_5
SID_6
answered 7 hours ago
Goro
8,13753978
8,13753978
add a comment |Â
add a comment |Â
up vote
1
down vote
using sed
sed -i ':a;N;$!ba;s/nS-/:S-/g' file
SID_1:S-1-2-12-347289564783285475
SID_2:S-1-2-12-312478290434839212:S-1-2-12-312748912347723432:S-1-2-12-123475184123489632
SID_3
SID_4:S-1-2-12-384721849326143123:S-1-2-12-324624783246712332
SID_5
SID_6
add a comment |Â
up vote
1
down vote
using sed
sed -i ':a;N;$!ba;s/nS-/:S-/g' file
SID_1:S-1-2-12-347289564783285475
SID_2:S-1-2-12-312478290434839212:S-1-2-12-312748912347723432:S-1-2-12-123475184123489632
SID_3
SID_4:S-1-2-12-384721849326143123:S-1-2-12-324624783246712332
SID_5
SID_6
add a comment |Â
up vote
1
down vote
up vote
1
down vote
using sed
sed -i ':a;N;$!ba;s/nS-/:S-/g' file
SID_1:S-1-2-12-347289564783285475
SID_2:S-1-2-12-312478290434839212:S-1-2-12-312748912347723432:S-1-2-12-123475184123489632
SID_3
SID_4:S-1-2-12-384721849326143123:S-1-2-12-324624783246712332
SID_5
SID_6
using sed
sed -i ':a;N;$!ba;s/nS-/:S-/g' file
SID_1:S-1-2-12-347289564783285475
SID_2:S-1-2-12-312478290434839212:S-1-2-12-312748912347723432:S-1-2-12-123475184123489632
SID_3
SID_4:S-1-2-12-384721849326143123:S-1-2-12-324624783246712332
SID_5
SID_6
answered 7 hours ago
msp9011
3,65043862
3,65043862
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f474348%2fline-up-horizontaly-security-identifier-numbers%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password