regex - Remove the data before the second repeated specified character in linux -
i have text file has below data:
ab-njcfnjnvne-802ac94f09314ee ab-kjncfvcnnjnwejj-e89ae688336716bb ab-pojkkvcmmmmmjhhgg-9ae6b707a18eb1d03b83c3 ab-qwertu-55c3375fb1ee8bcd8c491e24b2
i need remove data before second hyphen (-
) , produce text file below output:
802ac94f09314ee e89ae688336716bb 9ae6b707a18eb1d03b83c3 55c3375fb1ee8bcd8c491e24b2
i pretty new linux , trying sed
command unsuccessful attempts last couple of hours. how can desired output sed or other useful command awk
?
you can use simple cut
call:
$ cat myfile.txt | cut -d"-" -f3- > myoutput.txt
edit:
explanation, requested in comments: cut
breaks string of text fields according given delimiter.
-d
defines delimiter, -
in case.
-f
defines fields output. in case, want eliminate before second hyphen, or, in other words, return third field , onwards (3-
).
the rest of command piping output. cat
ing file cut
, , saving result output file.