Long lines in test.awk


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Long lines in test.awk
# 1  
Old 10-16-2010
Long lines in test.awk

I have a awk script called test.awk which I run using

Code:
awk -f test.awk file1.txt > file2.txt

I am doing a long print statement and want to put it in separate lines

Do I need a '/' at the end or not?????

Should it be like this

Code:
print $1,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,
         $2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,
         $2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2

or like this

Code:
print $1,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,  \
         $2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,              \
         $2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2


Last edited by kristinu; 10-17-2010 at 05:27 PM..
# 2  
Old 10-17-2010
# 3  
Old 10-17-2010
I don't need a '/' at the end it seems

---------- Post updated at 11:46 PM ---------- Previous update was at 11:24 PM ----------

I want to use printf so that I get neat columns. Getting confused on how to use the format such as %-8d for all the values $2. Is there a neat way to do this?
# 4  
Old 10-17-2010
may be you should use for loop instead repeating $2 many times?
printf can be used for formatting as you want.

If you could post sample input line and output record, it would be more cleaar
# 5  
Old 10-17-2010
Code:
printf $1 FS; for (i=1;i<=50;i++) printf $2 FS; printf RS

# 6  
Old 10-17-2010
The code looks somethings like this

Code:
      if (z == zmin - dz) {
        #      z  0  2  4  6  8 10 12 14 16 18 20 22 24 26 28
        #        30 32 34 36 38 40 42 44 46 48 50
        #        52 54 56 58 60 62 64 66 68 70 72 74 76 78 80
        print $1,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,
                 c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,
                 $2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2
      }

      if (z == zmin) {
        #      z  0  2  4  6  8 10 12 14 16 18 20 22 24 26 28
        #        30 32 34 36 38 40 42 44 46 48 50
        #        52 54 56 58 60 62 64 66 68 70 72 74 76 78 80
        print $1,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,c1,
                 c2,c2,c2,c2,c2,c2,c2,c2,c2,c2,c2,
                 c1,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2
      }

      if (z == zmin + dz) {
        #      z  0  2  4  6  8 10 12 14 16 18 20 22 24 26 28
        #        30 32 34 36 38 40 42 44 46 48 50
        #        52 54 56 58 60 62 64 66 68 70 72 74 76 78 80
        print $1,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,c1,c2,
                 c3,c3,c3,c3,c3,c3,c3,c3,c3,c3,c3,
                 c2,c1,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2
      }

      # -------------------------------------------------------------
      # 5. Full negative or positive anomaly

      if ((zmin + dz < z) && (z < zmax - dz)) {
        #      z  0  2  4  6  8 10 12 14 16 18 20 22 24 26 28
        #        30 32 34 36 38 40 42 44 46 48 50
        #        52 54 56 58 60 62 64 66 68 70 72 74 76 78 80
        print $1,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,c1,c2,c3,
                 ca,ca,ca,ca,ca,ca,ca,ca,ca,ca,ca,
                 c3,c2,c1,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2
      }


Here's one of the results. The table is all mixed up, not neatly in columns.


Code:
-0.5 0.41180 0.41180 0.41180 0.41180 0.41180 0.41180 0.41180 0.41180 0.41180 0.41180 0.41180 0.41180 0.41180 0.41180 0.41180 0.405623 0.405623 0.405623 0.405623 0.405623 0.405623 0.405623 0.405623 0.405623 0.405623 0.405623 0.41180 0.41180 0.41180 0.41180 0.41180 0.41180 0.41180 0.41180 0.41180 0.41180 0.41180 0.41180 0.41180 0.41180 0.41180
0.0 0.47355 0.47355 0.47355 0.47355 0.47355 0.47355 0.47355 0.47355 0.47355 0.47355 0.47355 0.47355 0.47355 0.47355 0.466447 0.459344 0.459344 0.459344 0.459344 0.459344 0.459344 0.459344 0.459344 0.459344 0.459344 0.459344 0.466447 0.47355 0.47355 0.47355 0.47355 0.47355 0.47355 0.47355 0.47355 0.47355 0.47355 0.47355 0.47355 0.47355 0.47355
0.5 0.61679 0.61679 0.61679 0.61679 0.61679 0.61679 0.61679 0.61679 0.61679 0.61679 0.61679 0.61679 0.61679 0.607538 0.598286 0.589034 0.589034 0.589034 0.589034 0.589034 0.589034 0.589034 0.589034 0.589034 0.589034 0.589034 0.598286 0.607538 0.61679 0.61679 0.61679 0.61679 0.61679 0.61679 0.61679 0.61679 0.61679 0.61679 0.61679 0.61679 0.61679
1.0 0.70957 0.70957 0.70957 0.70957 0.70957 0.70957 0.70957 0.70957 0.70957 0.70957 0.70957 0.70957 0.698926 0.688283 0.677639 0.666996 0.666996 0.666996 0.666996 0.666996 0.666996 0.666996 0.666996 0.666996 0.666996 0.666996 0.677639 0.688283 0.698926 0.70957 0.70957 0.70957 0.70957 0.70957 0.70957 0.70957 0.70957 0.70957 0.70957 0.70957 0.70957
1.5 0.78973 0.78973 0.78973 0.78973 0.78973 0.78973 0.78973 0.78973 0.78973 0.78973 0.78973 0.78973 0.777884 0.766038 0.754192 0.742346 0.742346 0.742346 0.742346 0.742346 0.742346 0.742346 0.742346 0.742346 0.742346 0.742346 0.754192 0.766038 0.777884 0.78973 0.78973 0.78973 0.78973 0.78973 0.78973 0.78973 0.78973 0.78973 0.78973 0.78973 0.78973
2.0 0.86628 0.86628 0.86628 0.86628 0.86628 0.86628 0.86628 0.86628 0.86628 0.86628 0.86628 0.86628 0.853286 0.840292 0.827297 0.814303 0.814303 0.814303 0.814303 0.814303 0.814303 0.814303 0.814303 0.814303 0.814303 0.814303 0.827297 0.840292 0.853286 0.86628 0.86628 0.86628 0.86628 0.86628 0.86628 0.86628 0.86628 0.86628 0.86628 0.86628 0.86628
2.5 0.94252 0.94252 0.94252 0.94252 0.94252 0.94252 0.94252 0.94252 0.94252 0.94252 0.94252 0.94252 0.928382 0.914244 0.900107 0.885969 0.885969 0.885969 0.885969 0.885969 0.885969 0.885969 0.885969 0.885969 0.885969 0.885969 0.900107 0.914244 0.928382 0.94252 0.94252 0.94252 0.94252 0.94252 0.94252 0.94252 0.94252 0.94252 0.94252 0.94252 0.94252
3.0 1.02012 1.02012 1.02012 1.02012 1.02012 1.02012 1.02012 1.02012 1.02012 1.02012 1.02012 1.02012 1.00482 0.989516 0.974215 0.958913 0.958913 0.958913 0.958913 0.958913 0.958913 0.958913 0.958913 0.958913 0.958913 0.958913 0.974215 0.989516 1.00482 1.02012 1.02012 1.02012 1.02012 1.02012 1.02012 1.02012 1.02012 1.02012 1.02012 1.02012 1.02012
3.5 1.09985 1.09985 1.09985 1.09985 1.09985 1.09985 1.09985 1.09985 1.09985 1.09985 1.09985 1.09985 1.08335 1.06685 1.05036 1.03386 1.03386 1.03386 1.03386 1.03386 1.03386 1.03386 1.03386 1.03386 1.03386 1.03386 1.05036 1.06685 1.08335 1.09985 1.09985 1.09985 1.09985 1.09985 1.09985 1.09985 1.09985 1.09985 1.09985 1.09985 1.09985
4.0 1.18132 1.18132 1.18132 1.18132 1.18132 1.18132 1.18132 1.18132 1.18132 1.18132 1.18132 1.18132 1.1636 1.14588 1.12816 1.11044 1.11044 1.11044 1.11044 1.11044 1.11044 1.11044 1.11044 1.11044 1.11044 1.11044 1.12816 1.14588 1.1636 1.18132 1.18132 1.18132 1.18132 1.18132 1.18132 1.18132 1.18132 1.18132 1.18132 1.18132 1.18132
4.5 1.26366 1.26366 1.26366 1.26366 1.26366 1.26366 1.26366 1.26366 1.26366 1.26366 1.26366 1.26366 1.24471 1.22575 1.2068 1.18784 1.18784 1.18784 1.18784 1.18784 1.18784 1.18784 1.18784 1.18784 1.18784 1.18784 1.2068 1.22575 1.24471 1.26366 1.26366 1.26366 1.26366 1.26366 1.26366 1.26366 1.26366 1.26366 1.26366 1.26366 1.26366
5.0 1.34708 1.34708 1.34708 1.34708 1.34708 1.34708 1.34708 1.34708 1.34708 1.34708 1.34708 1.34708 1.32687 1.30667 1.28646 1.26626 1.26626 1.26626 1.26626 1.26626 1.26626 1.26626 1.26626 1.26626 1.26626 1.26626 1.28646 1.30667 1.32687 1.34708 1.34708 1.34708 1.34708 1.34708 1.34708 1.34708 1.34708 1.34708 1.34708 1.34708 1.34708
5.5 1.43177 1.43177 1.43177 1.43177 1.43177 1.43177 1.43177 1.43177 1.43177 1.43177 1.43177 1.43177 1.41029 1.38882 1.36734 1.34586 1.34586 1.34586 1.34586 1.34586 1.34586 1.34586 1.34586 1.34586 1.34586 1.34586 1.36734 1.38882 1.41029 1.43177 1.43177 1.43177 1.43177 1.43177 1.43177 1.43177 1.43177 1.43177 1.43177 1.43177 1.43177
6.0 1.52082 1.52082 1.52082 1.52082 1.52082 1.52082 1.52082 1.52082 1.52082 1.52082 1.52082 1.52082 1.49801 1.4752 1.45238 1.42957 1.42957 1.42957 1.42957 1.42957 1.42957 1.42957 1.42957 1.42957 1.42957 1.42957 1.45238 1.4752 1.49801 1.52082 1.52082 1.52082 1.52082 1.52082 1.52082 1.52082 1.52082 1.52082 1.52082 1.52082 1.52082
6.5 1.61045 1.61045 1.61045 1.61045 1.61045 1.61045 1.61045 1.61045 1.61045 1.61045 1.61045 1.61045 1.58629 1.56214 1.53798 1.51382 1.51382 1.51382 1.51382 1.51382 1.51382 1.51382 1.51382 1.51382 1.51382 1.51382 1.53798 1.56214 1.58629 1.61045 1.61045 1.61045 1.61045 1.61045 1.61045 1.61045 1.61045 1.61045 1.61045 1.61045 1.61045
7.0 1.70159 1.70159 1.70159 1.70159 1.70159 1.70159 1.70159 1.70159 1.70159 1.70159 1.70159 1.70159 1.67607 1.65054 1.62502 1.59949 1.59949 1.59949 1.59949 1.59949 1.59949 1.59949 1.59949 1.59949 1.59949 1.59949 1.62502 1.65054 1.67607 1.70159 1.70159 1.70159 1.70159 1.70159 1.70159 1.70159 1.70159 1.70159 1.70159 1.70159 1.70159
7.5 1.79329 1.79329 1.79329 1.79329 1.79329 1.79329 1.79329 1.79329 1.79329 1.79329 1.79329 1.79329 1.76639 1.73949 1.71259 1.68569 1.68569 1.68569 1.68569 1.68569 1.68569 1.68569 1.68569 1.68569 1.68569 1.68569 1.71259 1.73949 1.76639 1.79329 1.79329 1.79329 1.79329 1.79329 1.79329 1.79329 1.79329 1.79329 1.79329 1.79329 1.79329
8.0 1.88292 1.88292 1.88292 1.88292 1.88292 1.88292 1.88292 1.88292 1.88292 1.88292 1.88292 1.88292 1.85468 1.82643 1.79819 1.76994 1.76994 1.76994 1.76994 1.76994 1.76994 1.76994 1.76994 1.76994 1.76994 1.76994 1.79819 1.82643 1.85468 1.88292 1.88292 1.88292 1.88292 1.88292 1.88292 1.88292 1.88292 1.88292 1.88292 1.88292 1.88292
8.5 1.96947 1.96947 1.96947 1.96947 1.96947 1.96947 1.96947 1.96947 1.96947 1.96947 1.96947 1.96947 1.93993 1.91039 1.88084 1.8513 1.8513 1.8513 1.8513 1.8513 1.8513 1.8513 1.8513 1.8513 1.8513 1.8513 1.88084 1.91039 1.93993 1.96947 1.96947 1.96947 1.96947 1.96947 1.96947 1.96947 1.96947 1.96947 1.96947 1.96947 1.96947
9.0 2.05162 2.05162 2.05162 2.05162 2.05162 2.05162 2.05162 2.05162 2.05162 2.05162 2.05162 2.05162 2.02085 1.99007 1.9593 1.92852 1.92852 1.92852 1.92852 1.92852 1.92852 1.92852 1.92852 1.92852 1.92852 1.92852 1.9593 1.99007 2.02085 2.05162 2.05162 2.05162 2.05162 2.05162 2.05162 2.05162 2.05162 2.05162 2.05162 2.05162 2.05162
9.5 2.12917 2.12917 2.12917 2.12917 2.12917 2.12917 2.12917 2.12917 2.12917 2.12917 2.12917 2.12917 2.09723 2.06529 2.03336 2.00142 2.00142 2.00142 2.00142 2.00142 2.00142 2.00142 2.00142 2.00142 2.00142 2.00142 2.03336 2.06529 2.09723 2.12917 2.12917 2.12917 2.12917 2.12917 2.12917 2.12917 2.12917 2.12917 2.12917 2.12917 2.12917
10.0 2.20167 2.20167 2.20167 2.20167 2.20167 2.20167 2.20167 2.20167 2.20167 2.20167 2.20167 2.20167 2.16864 2.13562 2.10259 2.06957 2.06957 2.06957 2.06957 2.06957 2.06957 2.06957 2.06957 2.06957 2.06957 2.06957 2.10259 2.13562 2.16864 2.20167 2.20167 2.20167 2.20167 2.20167 2.20167 2.20167 2.20167 2.20167 2.20167 2.20167 2.20167
10.5 2.26967 2.26967 2.26967 2.26967 2.26967 2.26967 2.26967 2.26967 2.26967 2.26967 2.26967 2.26967 2.23562 2.20158 2.16753 2.13349 2.13349 2.13349 2.13349 2.13349 2.13349 2.13349 2.13349 2.13349 2.13349 2.13349 2.16753 2.20158 2.23562 2.26967 2.26967 2.26967 2.26967 2.26967 2.26967 2.26967 2.26967 2.26967 2.26967 2.26967 2.26967
11.0 2.33375 2.33375 2.33375 2.33375 2.33375 2.33375 2.33375 2.33375 2.33375 2.33375 2.33375 2.33375 2.29874 2.26374 2.22873 2.19373 2.19373 2.19373 2.19373 2.19373 2.19373 2.19373 2.19373 2.19373 2.19373 2.19373 2.22873 2.26374 2.29874 2.33375 2.33375 2.33375 2.33375 2.33375 2.33375 2.33375 2.33375 2.33375 2.33375 2.33375 2.33375
11.5 2.39451 2.39451 2.39451 2.39451 2.39451 2.39451 2.39451 2.39451 2.39451 2.39451 2.39451 2.39451 2.35859 2.32267 2.28676 2.25084 2.25084 2.25084 2.25084 2.25084 2.25084 2.25084 2.25084 2.25084 2.25084 2.25084 2.28676 2.32267 2.35859 2.39451 2.39451 2.39451 2.39451 2.39451 2.39451 2.39451 2.39451 2.39451 2.39451 2.39451 2.39451
12.0 2.45289 2.45289 2.45289 2.45289 2.45289 2.45289 2.45289 2.45289 2.45289 2.45289 2.45289 2.45289 2.4161 2.3793 2.34251 2.30572 2.30572 2.30572 2.30572 2.30572 2.30572 2.30572 2.30572 2.30572 2.30572 2.30572 2.34251 2.3793 2.4161 2.45289 2.45289 2.45289 2.45289 2.45289 2.45289 2.45289 2.45289 2.45289 2.45289 2.45289 2.45289
12.5 2.50988 2.50988 2.50988 2.50988 2.50988 2.50988 2.50988 2.50988 2.50988 2.50988 2.50988 2.50988 2.47223 2.43458 2.39694 2.35929 2.35929 2.35929 2.35929 2.35929 2.35929 2.35929 2.35929 2.35929 2.35929 2.35929 2.39694 2.43458 2.47223 2.50988 2.50988 2.50988 2.50988 2.50988 2.50988 2.50988 2.50988 2.50988 2.50988 2.50988 2.50988
13.0 2.56583 2.56583 2.56583 2.56583 2.56583 2.56583 2.56583 2.56583 2.56583 2.56583 2.56583 2.56583 2.52734 2.48886 2.45037 2.41188 2.41188 2.41188 2.41188 2.41188 2.41188 2.41188 2.41188 2.41188 2.41188 2.41188 2.45037 2.48886 2.52734 2.56583 2.56583 2.56583 2.56583 2.56583 2.56583 2.56583 2.56583 2.56583 2.56583 2.56583 2.56583
13.5 2.62135 2.62135 2.62135 2.62135 2.62135 2.62135 2.62135 2.62135 2.62135 2.62135 2.62135 2.62135 2.58203 2.54271 2.50339 2.46407 2.46407 2.46407 2.46407 2.46407 2.46407 2.46407 2.46407 2.46407 2.46407 2.46407 2.50339 2.54271 2.58203 2.62135 2.62135 2.62135 2.62135 2.62135 2.62135 2.62135 2.62135 2.62135 2.62135 2.62135 2.62135
14.0 2.67692 2.67692 2.67692 2.67692 2.67692 2.67692 2.67692 2.67692 2.67692 2.67692 2.67692 2.67692 2.63677 2.59661 2.55646 2.5163 2.5163 2.5163 2.5163 2.5163 2.5163 2.5163 2.5163 2.5163 2.5163 2.5163 2.55646 2.59661 2.63677 2.67692 2.67692 2.67692 2.67692 2.67692 2.67692 2.67692 2.67692 2.67692 2.67692 2.67692 2.67692
14.5 2.73262 2.73262 2.73262 2.73262 2.73262 2.73262 2.73262 2.73262 2.73262 2.73262 2.73262 2.73262 2.73262 2.69163 2.65064 2.60965 2.60965 2.60965 2.60965 2.60965 2.60965 2.60965 2.60965 2.60965 2.60965 2.60965 -0.163957 -0.163957 2.73262 2.73262 2.73262 2.73262 2.73262 2.73262 2.73262 2.73262 2.73262 2.73262 2.73262 2.73262 2.73262
15.0 2.78835 2.78835 2.78835 2.78835 2.78835 2.78835 2.78835 2.78835 2.78835 2.78835 2.78835 2.78835 2.78835 2.78835 2.74652 2.7047 2.7047 2.7047 2.7047 2.7047 2.7047 2.7047 2.7047 2.7047 2.7047 2.7047 2.74652 2.78835 2.78835 2.78835 2.78835 2.78835 2.78835 2.78835 2.78835 2.78835 2.78835 2.78835 2.78835 2.78835 2.78835
15.5 2.84383 2.84383 2.84383 2.84383 2.84383 2.84383 2.84383 2.84383 2.84383 2.84383 2.84383 2.84383 2.84383 2.84383 2.84383 2.80117 2.80117 2.80117 2.80117 2.80117 2.80117 2.80117 2.80117 2.80117 2.80117 2.80117 2.84383 2.84383 2.84383 2.84383 2.84383 2.84383 2.84383 2.84383 2.84383 2.84383 2.84383 2.84383 2.84383 2.84383 2.84383
16.0 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912 2.89912
16.5 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447 2.95447
17.0 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996 3.00996
17.5 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547 3.06547
18.0 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072 3.12072
18.5 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559 3.17559
19.0 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991 3.22991
19.5 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356 3.28356
20.0 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637 3.33637
20.5 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845 3.38845
21.0 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982 3.43982
21.5 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070 3.49070
22.0 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116 3.54116
22.5 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118 3.59118
23.0 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075 3.64075
23.5 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981 3.68981
24.0 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830 3.73830
24.5 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624 3.78624
25.0 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357 3.83357
25.5 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023 3.88023
26.0 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627 3.92627
26.5 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177 3.97177
27.0 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662 4.01662
27.5 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096 4.06096
28.0 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497 4.10497
28.5 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857 4.14857
29.0 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179 4.19179
29.5 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469 4.23469
30.0 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726 4.27726



---------- Post updated at 02:26 PM ---------- Previous update was at 06:12 AM ----------

I have been trying to find if in awk one needs to use the continuation line '\' for long commands if I want to spead it on multiple lines. All I could find is that one needs it if awk is called within a csh script
# 7  
Old 10-17-2010
The line break '\' is used for display purposes in the source code of any awk program. Meaning, when you have a long line of code and you want to clarify the source code by neatly breaking the long line. It is not part of the output display of the program.

If you want to display break lines in the out put of awk use "\n"
e.g.

Code:
 echo "21 22 2388" | awk '{ print $1, $2, $3, "\n" $3, $2, $1 }'
21 22 2388 
2388 22 21

As you see, that doesn't help much with the neatly display in columns. Every comma between fields will display the default outfield separator which is a space.
Now, you can change the default with perhaps a tab
Code:
echo "21 22 2388" | awk ' OFS="\t" { print $1, $2, $3, "\n" $3, $2, $1 }'
21    22    2388    
2388  22    21

Otherwise, play with the built-in function printf
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

sed and awk for long lines

Hi, I'm trying make a variable length file to a fixed length of 4000. I'm to pad spaces on the right of a record if length is less than 4000 to make the record length 4000. I'm trying to use the below commands awk '{printf "%-4000s\n", $0}' inputfile.dat > outputfile.dat sed -e :a... (12 Replies)
Discussion started by: uxusr
12 Replies

2. UNIX for Dummies Questions & Answers

Bash does not wrap long lines correctly

Ksh is my default shell, but I want use the bash shell since its convenient to me. When I type a long command line in a terminal, it does not wrap to the next line when I reach the end of the line and it wraps onto the same line, overwriting my prompt and the rest of what I typed. $... (5 Replies)
Discussion started by: senthil.ak
5 Replies

3. Shell Programming and Scripting

Long line displayed as multiple lines in Outlook. Please help!

When a file generated by a shell script is sent as a mail (not as an attachment), in MS Outlook, single lines of the file are displayed as two/three lines (as the lines are long). Is there a way to make each line to be displayed in 'single line with scroll bar' to enable viewing of the long line? (2 Replies)
Discussion started by: thulasidharan2k
2 Replies

4. Shell Programming and Scripting

Long line displayed as multiple lines in Outlook. Please help!

When a file generated by a shell script is sent as a mail (not an attachment), in MS Outlook, single lines of the file are displayed as two/three lines (as the lines are long). Is there a way to make each line to be displayed in 'single line with scroll bar' to enable viewing of the long line? ... (0 Replies)
Discussion started by: thulasidharan2k
0 Replies

5. Shell Programming and Scripting

Pull specific lines from long file based on formula

For people who want to pull a number of lines from a long file using a specific formula n (number of iterations in a loop) a (offset number) b (stretch factor) example with n {1..100} for (( n=1; n<101; n++ )); do awk -v n=$n 'NR==a+(b*n)' a=0 b=1 inputfile >>outputfile (2 Replies)
Discussion started by: sgruenwald
2 Replies

6. Shell Programming and Scripting

splitting long string into several lines?

I'm using a barcode scanner to grab ISBNs. Unfortunately, short of hitting "enter" each time (not easy while on a ladder), there's no good way to split it up. So I scanned it into a series of long lines in notepad. Now, I need to split each line into 12-number lines. instead of:... (4 Replies)
Discussion started by: mbourgon
4 Replies

7. Shell Programming and Scripting

Breaking long lines into (characters, newline, space) groups

Hello, I am currently trying to edit an ldif file. The ldif specification states that a newline followed by a space indicates the subsequent line is a continuation of the line. So, in order to search and replace properly and edit the file, I open the file in textwrangler, search for "\r " and... (14 Replies)
Discussion started by: rowie718
14 Replies

8. UNIX for Dummies Questions & Answers

Lines too long error

Hi Gurus, I have a big file having around 5000 lines. What I need to do is as below. $cat myfile aaaa bbbb ccc ddd ... I want the output to be as below: 'aaaa,'bbbb','cccc'.... For this I have written something like this code: vi sac.txt |nawk '{printf NR","}'>ss code: (2 Replies)
Discussion started by: thana
2 Replies

9. UNIX for Dummies Questions & Answers

removing lines in a too long file

HI, i need to remove about a 3000000 lines in a "too long file", without using vi editor. Im using hp-ux 11.0. (4 Replies)
Discussion started by: Goodfella
4 Replies

10. Shell Programming and Scripting

Re: Long command lines

Hello, AIM: Need to test for the presence of some files (*.F) in a certain directory. having a problem with this line is ksh: if test `ls $SOMEDIR/dir/*.F \ 2>/dev/null|wc -w` -eq 0 Basically testing for the presence of *.F files in the specified directory. If the return... (4 Replies)
Discussion started by: enoch
4 Replies
Login or Register to Ask a Question