Hi there,
I want to add the following characters "chr" to the beginning of the first column of my data and print out the remaining columns.
sample.txt
1 10176 10177 rs367896724
1 10234 10235 rs540431307
1 10351 10352 rs555500075
data_desired.txt
chr1 10176 10177 rs367896724
chr1 10234 10235 rs540431307
chr1 10351 10352 rs555500075
I've developed the following code to do this, but it's taking a very long time to run and I'm concerned there is an issue. Does anyone see anything wrong with what I have? I'm new to shell scripting so any help would be greatly appreciated!
awk '{sub("^", "chr", $1)}; 1'; '{print $1,$2,$3,$4}' sample.txt > data_desired.txt