Something like grep -oE '<[^>]+>'
:
$ echo "Job <472971> Job Name <aaaaaaaaaaa> User <bbbbbbbbb> Project <cccccc> Status <RUN> Queue <AL_Ptime>Interactive pseudo-terminal shell mode Submitted from host <lsf_login07> CWD </asdfghjklll/dsadasd/asda>" \
| grep -oE '<[^>]+>'
<472971>
<aaaaaaaaaaa>
<bbbbbbbbb>
<cccccc>
<RUN>
<AL_Ptime>
<lsf_login07>
</asdfghjklll/dsadasd/asda>
If you want to get rid of the newlines and have spaces in between, you can pipe this into a simple awk like this:
grep -oE '<[^>]+>' | awk '{printf "%s%s", (NR==1?"":" "), $0}'
or with tr:
grep -oE '<[^>]+>' | tr "\n" " "
EDIT:
Suppose OP uses an input file with a number of these lines, one could turn to GNU awk:
$ cat tst.awk
BEGIN { FPAT="<[^>]+>" }
{ for (i=1; i<=NF; i++) printf "%s%s", (i==1?"":" "), $i
printf "\n"
}
Using it:
awk -f tst.awk file
where file is:
$ cat file
Job <472971> Job Name <aaaaaaaaaaa> User <bbbbbbbbb> Project <cccccc> Status <RUN> Queue <AL_Ptime>Interactive pseudo-terminal shell mode Submitted from host <lsf_login07> CWD </asdfghjklll/dsadasd/asda>
Job <472971> Job Name <aaaaaaaaaaa> User <bbbbbbbbb> Project <cccccc> Status <RUN> Queue <AL_Ptime>Interactive pseudo-terminal shell mode Submitted from host <lsf_login07> CWD </asdfghjklll/dsadasd/asda>
or, as a one-liner:
$ awk 'BEGIN{FPAT="<[^>]+>"} \
{for (i=1; i<=NF; i++) printf "%s%s", (i==1?"":" "), $i; printf "\n"}' file
<472971> <aaaaaaaaaaa> <bbbbbbbbb> <cccccc> <RUN> <AL_Ptime> <lsf_login07> </asdfghjklll/dsadasd/asda>
<472971> <aaaaaaaaaaa> <bbbbbbbbb> <cccccc> <RUN> <AL_Ptime> <lsf_login07> </asdfghjklll/dsadasd/asda>