Skip to main content

Through awk and keeping middle column:

awk '{printf("%.f ", ($1/65)+0.5)}1' infile > outfile
24 1533 C_P.doc
11 691 C_M.doc
14 905 G_S.doc
15 945 J_Z.doc
24 1549 J_M.doc
27 1701 L_B.doc

Through awk and without middle column:

awk '{printf("%.f", ($1/65)+0.5); $1=""}1' infile > outfile
24 C_P.doc
11 C_M.doc
14 G_S.doc
15 J_Z.doc
24 J_M.doc
27 L_B.doc

Note that +0.5 is used as substitute for simulatingthe cailceil() function in other commands like Perl there and it rounds up to the next number. And 1 on the end actives the default print.

Through awk and keeping middle column:

awk '{printf("%.f ", ($1/65)+0.5)}1' infile > outfile
24 1533 C_P.doc
11 691 C_M.doc
14 905 G_S.doc
15 945 J_Z.doc
24 1549 J_M.doc
27 1701 L_B.doc

Through awk and without middle column:

awk '{printf("%.f", ($1/65)+0.5); $1=""}1' infile > outfile
24 C_P.doc
11 C_M.doc
14 G_S.doc
15 J_Z.doc
24 J_M.doc
27 L_B.doc

Note that +0.5 is used for simulating cail() function in other commands like Perl there and it rounds up to the next number. And 1 on the end actives the default print.

Through awk and keeping middle column:

awk '{printf("%.f ", ($1/65)+0.5)}1' infile > outfile
24 1533 C_P.doc
11 691 C_M.doc
14 905 G_S.doc
15 945 J_Z.doc
24 1549 J_M.doc
27 1701 L_B.doc

Through awk and without middle column:

awk '{printf("%.f", ($1/65)+0.5); $1=""}1' infile > outfile
24 C_P.doc
11 C_M.doc
14 G_S.doc
15 J_Z.doc
24 J_M.doc
27 L_B.doc

Note that +0.5 is used as substitute for the ceil() function and it rounds up to the next number. And 1 on the end actives the default print.

added 176 characters in body
Source Link
αғsнιη
  • 41.9k
  • 17
  • 75
  • 117

Through awk and keeping middle column:

awk '{printf("%.f ", ($1/65)+0.5)}1' infile > outfile
24 1533 C_P.doc
11 691 C_M.doc
14 905 G_S.doc
15 945 J_Z.doc
24 1549 J_M.doc
27 1701 L_B.doc

Through awk and without middle column:

awk '{printf("%.f", ($1/65)+0.5); $1=""}1' infile > outfile
24 C_P.doc
11 C_M.doc
14 G_S.doc
15 J_Z.doc
24 J_M.doc
27 L_B.doc

Note that +0.5 is used for simulating cail() function in other commands like Perl there and it rounds up to the next number. And 1 on the end actives the default print.

Through awk and keeping middle column:

awk '{printf("%.f ", ($1/65)+0.5)}1' infile > outfile
24 1533 C_P.doc
11 691 C_M.doc
14 905 G_S.doc
15 945 J_Z.doc
24 1549 J_M.doc
27 1701 L_B.doc

Through awk and without middle column:

awk '{printf("%.f", ($1/65)+0.5); $1=""}1' infile > outfile
24 C_P.doc
11 C_M.doc
14 G_S.doc
15 J_Z.doc
24 J_M.doc
27 L_B.doc

Through awk and keeping middle column:

awk '{printf("%.f ", ($1/65)+0.5)}1' infile > outfile
24 1533 C_P.doc
11 691 C_M.doc
14 905 G_S.doc
15 945 J_Z.doc
24 1549 J_M.doc
27 1701 L_B.doc

Through awk and without middle column:

awk '{printf("%.f", ($1/65)+0.5); $1=""}1' infile > outfile
24 C_P.doc
11 C_M.doc
14 G_S.doc
15 J_Z.doc
24 J_M.doc
27 L_B.doc

Note that +0.5 is used for simulating cail() function in other commands like Perl there and it rounds up to the next number. And 1 on the end actives the default print.

Source Link
αғsнιη
  • 41.9k
  • 17
  • 75
  • 117

Through awk and keeping middle column:

awk '{printf("%.f ", ($1/65)+0.5)}1' infile > outfile
24 1533 C_P.doc
11 691 C_M.doc
14 905 G_S.doc
15 945 J_Z.doc
24 1549 J_M.doc
27 1701 L_B.doc

Through awk and without middle column:

awk '{printf("%.f", ($1/65)+0.5); $1=""}1' infile > outfile
24 C_P.doc
11 C_M.doc
14 G_S.doc
15 J_Z.doc
24 J_M.doc
27 L_B.doc