-4

let's consider following format of raws:

| Node[42]{id:42} | Node[208813]{id:208813} | Node[292823]{id:292823} |

Is is possible to use Linux tools to map it into:
42,208813,292823

Where, these numbers are numbers gathered from [].
Please note that I search for universal method for more columns, for example:
| Node[42]{id:42} | Node[208813]{id:208813} | Node[292823]{id:292823} | Node[1]| into

42,208813,292823,1.
Please note also that {id:292823} is optional (it is not mandatory).

Can anyone help?

n2485883
  • 15
  • 1
  • 3
  • 1
    What is the problem with your approach? – Wiktor Stribiżew Jul 17 '18 at 17:01
  • Please avoid *"Give me the codez"* questions. Instead show the script you are working on and state where the problem is. Also see [How much research effort is expected of Stack Overflow users?](https://meta.stackoverflow.com/q/261592/608639) – jww Jul 17 '18 at 17:04
  • Please take a look at: [What should I do when someone answers my question?](http://stackoverflow.com/help/someone-answers) – Cyrus Jul 17 '18 at 19:30

1 Answers1

-1

With sed:

sed 's/[^[]*\[//;s/\][^[]*\[/,/g;s/].*//' file

Output:

42,208813,292823

See: man sed and The Stack Overflow Regular Expressions FAQ

Cyrus
  • 69,405
  • 13
  • 65
  • 117