I'm running Ubuntu 18.04 LTS. I have a text file named "group_keys", which contains a number of public keys that I'd like to split based on the delimiter
-----BEGIN PUBLIC KEY-----
and then output each key individually and sequentially. For example, if there are three keys, then the output would be three files with names like "person_1_key", "person_2_key", and "person_3_key".
The file looks like this:
I'm having difficulty using split
and csplit
to do this. The commands I'm inputting aren't working. Here's what I've tried;
Using split:
split --separator="-----BEGIN PUBLIC KEY-----" group_keys
This doesn't output anything, but instead gives me the message
split: multi-character separator ‘-----BEGIN PUBLIC KEY-----’
Using csplit:
csplit group_keys "-----BEGIN PUBLIC KEY-----"
This gives me only two files, "xx00" and "xx01", but it doesn't split the lines. "xx00" is completely blank, and the "xx01" is just the original file.