Answer the question
In order to leave comments, you need to log in
How to split numbers in the first column of a file in bash?
there kind of file:
22 xxxxxxxxxxxxxxxx
2 yyyyyyyyyyyyyyyyyyyyyy
2 qqqqqqqqqqqqqqqqqq
6 xxxxxxxxxxxxxxxxxxxx
4 ffffffffffffffff
4 9718947ddddddddddddddddddd
4 2351273512735 0989089089
4 lllllllllllllllllllllllll
possible to divide into 2 all the numbers in the first column, leaving intact the remaining columns, while preserving file structure?
Answer the question
In order to leave comments, you need to log in
You can for example like this:
[~]# cat test.txt
22 xxxxxxxxxxxxxxxx
2 yyyyyyyyyyyyyyyyyyyyyy
2 qqqqqqqqqqqqqqqqqq
6 xxxxxxxxxxxxxxxxxxxx
4 ffffffffffffffff
4 9718947ddddddddddddddddddd
4 2351273512735 0989089089
4 lllllllllllllllllllllllll
[~]# cat test.txt | awk '{$1=$1/2; print}'
11 xxxxxxxxxxxxxxxx
1 yyyyyyyyyyyyyyyyyyyyyy
1 qqqqqqqqqqqqqqqqqq
3 xxxxxxxxxxxxxxxxxxxx
2 ffffffffffffffff
2 9718947ddddddddddddddddddd
2 2351273512735 0989089089
2 lllllllllllllllllllllllll
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question