Dear Folks
Hello
I have a column of numbers, say:
26
79
68
I want to add one to each row value and get this desire column:
26
27
79
80
68
69
Thanks in advance
Saj
Dear Folks
Hello
I have a column of numbers, say:
26
79
68
I want to add one to each row value and get this desire column:
26
27
79
80
68
69
Thanks in advance
Saj
Any attempts/thoughts/ideas from your side?
---------- Post updated at 18:15 ---------- Previous update was at 18:13 ----------
Howsoever, try
awk '{print $1; print $1+1}' file
26
27
79
80
68
69
perl -pe '$_.=$_+1 ."\n"' sajmar.file
26
27
79
80
68
69
Hello Saj,
Following may help you too in same.
1st code:
awk '{for(i=1;i<=NF;i++){print $i ORS $i+1}}' FS="\n" RS="" Input_file
2nd code:
awk '{print $0 ORS $0+1}' Input_file
Output will be as follows in above both codes.
26
27
79
80
68
69
NOTE: These solutions are based on your shown inputs.
Thanks,
R. Singh
awk '1;{print $1+1}' sajmar.file
26
27
79
80
68
69
Thanks to all of the folks that gave their suggestions.
awk '1; {$1++} 1' file