linux - Take part of the string using bash -



linux - Take part of the string using bash -

this question has reply here:

how extract string next pattern grep, regex or perl 7 answers

i have string log file sending code like:

<timestamp> info [response--22] code [00000000] code sent [+0000002345]

could help me parsing using bash set code value (8chars) variable? give thanks help.

you utilize sed extract value:

sed 's/.*code *\[\([0-9]*\)].*/\1/' <<<"<timestamp> info [response--22] code [00000000] code sent [+0000002345]" 00000000

if line in file, can sed '...' filename. store output variable, can x=$(sed '...' filename).

linux bash parsing git-bash

Comments

Popular posts from this blog

javascript - THREE.js reposition vertices for RingGeometry -

javascript - I need to update the text of a paragraph by inline edit -

assembly - What is the addressing mode for ld, add, and rjmp instructions? -