Skip to main content
Commonmark migration
Source Link

##awk, 24 bytes

awk, 24 bytes

Field separator set to '' means that each char is in its own field and we can use NF as iterator from end to begining. To break record barriers, RS is also '' meaning record ends at first empty record (\n\n).

{for(;NF-->0;)printf$NF} 

Execution ends in an error as the NF-- reaches -1 and awk can't handle that. It could be handled with 2 more bytes to change the for(;NF-->0;) to for(;NF>0;NF--). Test it:

$ awk -F '' -v RS='' '{for(;NF-->0;)printf$NF}' file od yzal eht revo depmuj eH xof nworb kciuQawk: cmd. line:1: (FILENAME=asd FNR=1) fatal: NF set to negative value 

##awk, 24 bytes

Field separator set to '' means that each char is in its own field and we can use NF as iterator from end to begining. To break record barriers, RS is also '' meaning record ends at first empty record (\n\n).

{for(;NF-->0;)printf$NF} 

Execution ends in an error as the NF-- reaches -1 and awk can't handle that. It could be handled with 2 more bytes to change the for(;NF-->0;) to for(;NF>0;NF--). Test it:

$ awk -F '' -v RS='' '{for(;NF-->0;)printf$NF}' file od yzal eht revo depmuj eH xof nworb kciuQawk: cmd. line:1: (FILENAME=asd FNR=1) fatal: NF set to negative value 

awk, 24 bytes

Field separator set to '' means that each char is in its own field and we can use NF as iterator from end to begining. To break record barriers, RS is also '' meaning record ends at first empty record (\n\n).

{for(;NF-->0;)printf$NF} 

Execution ends in an error as the NF-- reaches -1 and awk can't handle that. It could be handled with 2 more bytes to change the for(;NF-->0;) to for(;NF>0;NF--). Test it:

$ awk -F '' -v RS='' '{for(;NF-->0;)printf$NF}' file od yzal eht revo depmuj eH xof nworb kciuQawk: cmd. line:1: (FILENAME=asd FNR=1) fatal: NF set to negative value 
Source Link

##awk, 24 bytes

Field separator set to '' means that each char is in its own field and we can use NF as iterator from end to begining. To break record barriers, RS is also '' meaning record ends at first empty record (\n\n).

{for(;NF-->0;)printf$NF} 

Execution ends in an error as the NF-- reaches -1 and awk can't handle that. It could be handled with 2 more bytes to change the for(;NF-->0;) to for(;NF>0;NF--). Test it:

$ awk -F '' -v RS='' '{for(;NF-->0;)printf$NF}' file od yzal eht revo depmuj eH xof nworb kciuQawk: cmd. line:1: (FILENAME=asd FNR=1) fatal: NF set to negative value