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

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -