0

How do I get the second string in

TE-2025|2bc80a34b83d11289a352f7d8a2e47204c283b4f|test|

using bash?

that is 2bc80a34b83d11289a352f7d8a2e47204c283b4f

This is not a duplicate. I want to get the second string not the first!

3
  • Where's the data stored? In a file? In a string variable? IFS may be part of the answer — or fancy options to read. Or you can use cut, awk, sed, perl, python, … or shell parameter expansion with the substitute variations. Commented Sep 1, 2016 at 22:07
  • I could swear I've answered this exact question already. Commented Sep 1, 2016 at 22:09
  • Ahh -- stackoverflow.com/questions/38927646/… -- very slightly different question about the same data (and data format), but my answer there does describe how to perform the exact operation requested here. Commented Sep 1, 2016 at 22:10

1 Answer 1

0
IFS='|' read -r first second _ <<<'PR-2025|2bc80a34b83d11289a352f7d8a2e47204c283b4f|test|'
echo "$second"
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.