Read and respond to this message at: https://sourceforge.net/projects/gnuwin32/forums/forum/74807/topic/4550522 By: reggie27
I just downloaded the gawk utility today to run commands in DOS on my PC. I can get a SUBSTR for numeric values to work in an IF statement, but I can't get alpha characters to work. When I run the following command: gawk "{if (substr($1,1,3) == "123") print $1}" baseball_test_file.txt > baseball_test_file1.txt, I get the correct data: 123 123xxx 123yyy. However, when I run this command: gawk "{if (substr($1,1,3) == "Sun") print $1}" baseball_test_file.txt > baseball_test_file2.txt, I get an empty file as a result. Below is my input data. I tried a bunch of different things, but I can't figure it out. Little help? 123 123xxx Fri, 4/1 at Rays W 4-1 1-0 Guthrie (1-0) Price (0-1) Sun, 4/3 at Rays W 5-1 3-0 Britton (1-0) Davis (0-1) Fri, 4/8 Rangers Postponed 5-1 Tue, 5/17 at Red Sox Postponed 19-21 Sat, 5/28 at Athletics L 2-4 24-26 Outman (1-0) Bergesen (1-6) 123yyy _____________________________________________________________________________________ You are receiving this email because you elected to monitor this topic or entire forum. To stop monitoring this topic visit: https://sourceforge.net/projects/gnuwin32/forums/forum/74807/topic/4550522/unmonitor To stop monitoring this forum visit: https://sourceforge.net/projects/gnuwin32/forums/forum/74807/unmonitor ------------------------------------------------------------------------------ vRanger cuts backup time in half-while increasing security. With the market-leading solution for virtual backup and recovery, you get blazing-fast, flexible, and affordable data protection. Download your free trial now. http://p.sf.net/sfu/quest-d2dcopy1 _______________________________________________ GnuWin32-Users mailing list GnuWin32-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gnuwin32-users