Hello I have a similar problem to the one in this [post][1]
But since I am new to Bash and my file is a bit different I could not modify and apply the answers to my code.
I have a csv file with multiple columns (all columns are comma separated), the column I want to split looks like this: (input file)
post_id
86680728811_272953252761568
86680728811_273859942672742
86680728811_281125741936891
86680728811_10150500662053812
_86680728811_10150500969563812
86680728811_10150501303143812
86680728811_305275689511038
_86680728811_10150501624593812
86680728811_10150501873973812
86680728811_145945585518261
I would like to extract the second id number (the one that comes after the underscore). Keeping in mind that some columns start with a number, some with space, and some with '_'.
The output I would like is to add two new columns each contain the IDs separated by '_'. Example of the first line:
page ID post ID
86680728811 272953252761568
I tried to use a regex to read the number:
awk -F',' '{print $2} /(?<=_)[0-9]+/' FB_Dataset.csv
But nothing I have tried has worked so far. Any suggestion would help. Thanks [1]: splitting a column using awk