Hi please help me to find only numbers. My file have only one line data as below:
53-Brand|5556-Color Family|10984-Fit|10313-Combo
Looking for output 53, 5556, 10984, 10313
Thanks
I tried
awk -F',' '{print $2}' /cat_formula > 1
53-Brand|5556-Color Family|10984-Fit|10313-Combo
awk -F'|' '{print $1}{print $2}{print $3}{print $4}' 1 >2
53-Brand
5556-Color Family
10984-Fit
10313-Combo
awk -F'-' '{print $1}' 2
53
5556
10984
10313
But looking in one command line.
grep -oP "\d+" filename
Output:
53
5556
10984
10313
brief explanation:
-P : tells it's a perl regexp
\d+: to match just numbers
-o : to capture just matched numbers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With