Home > OS >  How to implement identification Numbers and arithmetic using awk
How to implement identification Numbers and arithmetic using awk

Time:01-17

# # # Layer - top - set the features data # # #
# 94.55 1.5 r1500 P 1 0 N P
# 187.3 1.5 r1500 P 1 0 N P
# 1.8 1.5 r1500 P 1 0 N P
# 1.3 59.52 r1500 P 1 0 N P
# 1.8 66.5 r1500 P 1 0 N P
# 94.55 66.5 r1500 P 1 0 N P
# 187.3 66.5 r1500 P 1 0 N P
L 94.6670825 48.5123125 94.7419325 48.5366325 r100 P # 1
L 94.7419325 48.5366325 94.812055 48.5723625 r100 P # 1
L 94.812055 48.5723625 94.8757275 48.6186225 r100 P # 1
L 94.8757275 48.6186225 94.9313775 48.6742725 r100 P # 1
# A 1 68 0 67 1 67 r3 P 1 N
# 67 0 0 1 r3 L P 1
A 1 0 0 1 # 1 r3 P 1 N
# 1 0 0 r3 188.1 L P 1
# 1 188.1 A 188.1 0 and 189.1 r3 P 1 N
# 189.1 L 189.1 r3 67 P 1
# 189.1 67 188.1 68 188.1 r3 67 P A N 1


This is a text file, I'd like to use awk to implement the following function,
1. Delete the first line, I think of awk '$0! ~/^ # # #/{print $0} '1. TXT
2. The recognition for the digital format in the text of the text, and to do the digital computing x2, result is floating point format keep two decimal places
Really can't figure out how to implement the second point, bosses, please help have a look, if you have any other awk can't realize that there is a command,

CodePudding user response:

Take digital single body, I know how to write the awk script, the problem is you need to do operation, but also have to consider: do you want to distinguish between each column number, this is don't know how to operate the ~ ~ ~
  • Related