How to obtain only positive value in second column [closed]How to extract the positive numbers in the first column from an output as in the question?Using awk to change an entire column of both positive and negative values, to just negative?Is it possible to add consecutive columns in AWKMerge two files and plus the second column using AWKHow to print first column of next line in current line?How to print a specific column condition using awk?Calculate interval if value in column changesget average for all numbers with irregular columnsHow to obtain the last recently three dates of a file log?How to collapse consecutive numbers into ranges?

Does the Paladin's Aura of Protection affect only either her or ONE ally in range?

Why cruise at 7000' in an A319?

Does anycast addressing add additional latency in any way?

What determines the "strength of impact" of a falling object on the ground, momentum or energy?

C-152 carb heat on before landing in hot weather?

Intuitively, why does putting capacitors in series decrease the equivalent capacitance?

Should my manager be aware of private LinkedIn approaches I receive? How to politely have this happen?

Is my Rep in Stack-Exchange Form?

How can I convince my reader that I will not use a certain trope?

"It will become the talk of Paris" - translation into French

MH370 blackbox - is it still possible to retrieve data from it?

How to determine what is the correct level of detail when modelling?

A player is constantly pestering me about rules, what do I do as a DM?

Was touching your nose a greeting in second millenium Mesopotamia?

Mount a folder with a space on Linux

Find smallest index that is identical to the value in an array

Using “sparkling” as a diminutive of “spark” in a poem

What is this opening trap called, and how should I play afterwards? How can I refute the gambit, and play if I accept it?

What do you call the action of someone tackling a stronger person?

Does squid ink pasta bleed?

How risky is real estate?

Do French speakers not use the subjunctive informally?

How could mana leakage be dangerous to a elf?

Going to get married soon, should I do it on Dec 31 or Jan 1?



How to obtain only positive value in second column [closed]


How to extract the positive numbers in the first column from an output as in the question?Using awk to change an entire column of both positive and negative values, to just negative?Is it possible to add consecutive columns in AWKMerge two files and plus the second column using AWKHow to print first column of next line in current line?How to print a specific column condition using awk?Calculate interval if value in column changesget average for all numbers with irregular columnsHow to obtain the last recently three dates of a file log?How to collapse consecutive numbers into ranges?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















I use this command



awk 'NR%2t=$1;nextprint $1-t,$2'


to get the distance between two consecutive Y points in a file. But I would like to have all positive numbers. How to get that ? like something as modulus.



1577 -46.1492
1577.57 47
1578 -47.6528
1578.87 49
1579 -49.2106
1580 -50.7742
1580.15 51









share|improve this question















closed as unclear what you're asking by Kusalananda, jimmij, msp9011, Jeff Schaller, Anthony Geoghegan Mar 25 at 15:12


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.













  • 2





    It is unclear (as you can see from the answers) whether the data that you present is input to your existing awk script or output from it.

    – Kusalananda
    Mar 25 at 9:47

















3















I use this command



awk 'NR%2t=$1;nextprint $1-t,$2'


to get the distance between two consecutive Y points in a file. But I would like to have all positive numbers. How to get that ? like something as modulus.



1577 -46.1492
1577.57 47
1578 -47.6528
1578.87 49
1579 -49.2106
1580 -50.7742
1580.15 51









share|improve this question















closed as unclear what you're asking by Kusalananda, jimmij, msp9011, Jeff Schaller, Anthony Geoghegan Mar 25 at 15:12


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.













  • 2





    It is unclear (as you can see from the answers) whether the data that you present is input to your existing awk script or output from it.

    – Kusalananda
    Mar 25 at 9:47













3












3








3








I use this command



awk 'NR%2t=$1;nextprint $1-t,$2'


to get the distance between two consecutive Y points in a file. But I would like to have all positive numbers. How to get that ? like something as modulus.



1577 -46.1492
1577.57 47
1578 -47.6528
1578.87 49
1579 -49.2106
1580 -50.7742
1580.15 51









share|improve this question
















I use this command



awk 'NR%2t=$1;nextprint $1-t,$2'


to get the distance between two consecutive Y points in a file. But I would like to have all positive numbers. How to get that ? like something as modulus.



1577 -46.1492
1577.57 47
1578 -47.6528
1578.87 49
1579 -49.2106
1580 -50.7742
1580.15 51






awk numeric-data






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 25 at 9:44









Jeff Schaller

47.1k11 gold badges68 silver badges153 bronze badges




47.1k11 gold badges68 silver badges153 bronze badges










asked Mar 25 at 9:31









newstudentnewstudent

454 bronze badges




454 bronze badges




closed as unclear what you're asking by Kusalananda, jimmij, msp9011, Jeff Schaller, Anthony Geoghegan Mar 25 at 15:12


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









closed as unclear what you're asking by Kusalananda, jimmij, msp9011, Jeff Schaller, Anthony Geoghegan Mar 25 at 15:12


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









  • 2





    It is unclear (as you can see from the answers) whether the data that you present is input to your existing awk script or output from it.

    – Kusalananda
    Mar 25 at 9:47












  • 2





    It is unclear (as you can see from the answers) whether the data that you present is input to your existing awk script or output from it.

    – Kusalananda
    Mar 25 at 9:47







2




2





It is unclear (as you can see from the answers) whether the data that you present is input to your existing awk script or output from it.

– Kusalananda
Mar 25 at 9:47





It is unclear (as you can see from the answers) whether the data that you present is input to your existing awk script or output from it.

– Kusalananda
Mar 25 at 9:47










2 Answers
2






active

oldest

votes


















2














Command: awk '$2 !~ /^-/print $0' file

output

1577.57 47
1578.87 49
1580.15 51





share|improve this answer






























    3














    You can replace this:



    print $1-t,$2


    with this:



    if ($2>=0) print $1-t,$2


    or,



    $2 >= 0 print $1 - t, $2 





    share|improve this answer

































      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2














      Command: awk '$2 !~ /^-/print $0' file

      output

      1577.57 47
      1578.87 49
      1580.15 51





      share|improve this answer



























        2














        Command: awk '$2 !~ /^-/print $0' file

        output

        1577.57 47
        1578.87 49
        1580.15 51





        share|improve this answer

























          2












          2








          2







          Command: awk '$2 !~ /^-/print $0' file

          output

          1577.57 47
          1578.87 49
          1580.15 51





          share|improve this answer













          Command: awk '$2 !~ /^-/print $0' file

          output

          1577.57 47
          1578.87 49
          1580.15 51






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 25 at 9:42









          Praveen Kumar BSPraveen Kumar BS

          2,1692 gold badges3 silver badges11 bronze badges




          2,1692 gold badges3 silver badges11 bronze badges























              3














              You can replace this:



              print $1-t,$2


              with this:



              if ($2>=0) print $1-t,$2


              or,



              $2 >= 0 print $1 - t, $2 





              share|improve this answer





























                3














                You can replace this:



                print $1-t,$2


                with this:



                if ($2>=0) print $1-t,$2


                or,



                $2 >= 0 print $1 - t, $2 





                share|improve this answer



























                  3












                  3








                  3







                  You can replace this:



                  print $1-t,$2


                  with this:



                  if ($2>=0) print $1-t,$2


                  or,



                  $2 >= 0 print $1 - t, $2 





                  share|improve this answer















                  You can replace this:



                  print $1-t,$2


                  with this:



                  if ($2>=0) print $1-t,$2


                  or,



                  $2 >= 0 print $1 - t, $2 






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Mar 25 at 9:46









                  Kusalananda

                  152k18 gold badges300 silver badges479 bronze badges




                  152k18 gold badges300 silver badges479 bronze badges










                  answered Mar 25 at 9:35









                  Romeo NinovRomeo Ninov

                  7,5443 gold badges21 silver badges29 bronze badges




                  7,5443 gold badges21 silver badges29 bronze badges













                      Popular posts from this blog

                      Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                      SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                      은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현