Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. flogrr

    Windows 10 issue

    During the latest Windows 10 update the computer locked up. How does one get the PC to boot to the login screen? It wants to drop into setup of the BIOS. Thanks for your time. flogrr flogrr
  2. flogrr

    How to replace str1 with str2 in the nth field

    Hi Kathy, Given your example this should do it: awk '/^[0-9]+/ { if($3 ~ /yes/) $3 = "abc" }' infile > outfile This limits the action to only lines that begin with one or more numbers and tests field 3 for a match on "yes". If so, it replaces "yes" with...
  3. flogrr

    Altering address data in .csv files...

    Hi Allen, Here is another way! myfile.awk follows: { FS = &quot;,&quot; $1 = &quot;&quot; $2 = &quot;&quot; fld3 = $3 text = substr ($3,4) for (j = 3; j >= 1; j--) { $3 = (fld3 - j)text for (a = 3; a < NF; a++) printf(&quot;%s,&quot;, $a)...
  4. flogrr

    Why does this skip lines??

    Hi Shaun, It looks like since you do not use explicit &quot;return&quot; statements in your functions, the AWK language automatically returns the data that was processed by the function call. Therefore, you may simply need to add a &quot;print&quot; immediately after the call to the Unblock...
  5. flogrr

    Script error

    Hi lambros, If I understand what you are trying to do correctly, this should work. I did not use arrays, but captured the data you wanted in substrings and put it together as one output record. Using the sample input you provided, this is the output: (13/Oct/2002:15:22:57 ) : 'lambros' Test...
  6. flogrr

    Script error

    Hi lambros, It looks like part of the problem is the reg[0]=$1 AWK does not work the same as 'C' when it comes to arrays. Try changing the zero to one: reg[1]=$1 If the error persists, please post some example input and what the output should look like. flogrr flogr@yahoo.com
  7. flogrr

    Variable question

    Hi Vlad! Thanks for the welcome. Since 9/11 I have been kept very busy with no sign of relief! I do check on what is going on but cannot spare the time to help out a lot. However, you folks (Cakiwi, marsd, yourself, and others) have been dealing with some complex awk problems lately and...
  8. flogrr

    Variable question

    Jo- O.K., this is what you need to do: #!/bin/sh # Must be run in Bourne Shell test=$1 When used within nawk it is addressed: &quot;'$test'&quot; # Have to have double layer of quotes # to protect var from interpretation # by the shell So, just...
  9. flogrr

    Variable question

    Hi jo90, You may have to enclose in double quotes: nawk -v var=&quot;01/Oct/2002:15:56:55&quot; -f awkscript.awk You may also have to add backslashes to escape the forward slashes: nawk -v var=&quot;01\/Oct\/2002:15:56:55&quot; -f awkscript.awk One or the other should work for you...
  10. flogrr

    Output redirection

    Hi goldenradium2001, Try this solution: awk ' FILENAME == &quot;output&quot; { lines[++i] = $0 } FILENAME == &quot;file1&quot; { fld3[++j] = $3 } END { for( k = 1; k <= i; k++ ) printf (&quot;%s %s\n&quot;, lines[k], fld3[k]) }' output file1 > file2 Hope this helps flogrr...
  11. flogrr

    printing from field 2 to the end

    Hi erixire, This will do it but it will leave the field separator between F1 and F2: awk '{$1=&quot;&quot;;print}' input > output however, NAWK can take care of it with: nawk 'BEGIN{FS=&quot; &quot;}{$1=&quot;&quot;;sub(&quot; &quot;,&quot;&quot;);print}' input > output To use the nawk...
  12. flogrr

    How to print exact pages ?

    Hi Kevin! Simply edit in a control &quot;L&quot; (^L) immediately following the last line of each page. This will cause the printer to form feed exactly where you want it to! Hope this helps you. flogrr flogr@yahoo.com
  13. flogrr

    incrementing blank array element

    Hi cback- I have tried to solve this for you, but alas, no dice! However, to understand what is happening, refer to the AWK SUMMARY in APPENDIX A (page 192) of The AWK Programming Language book. Here you will find a lucid description as to why AWK acts this way. HTH flogrr...
  14. flogrr

    Parse And Save

    Hi Dave- I modified the script by bigoldbulldog and it seems to work. Try it and change things the way you need them. I tried to set it up to allow some flexibility in how you want to move (mv) files, etc. /\.00[12]/{ fn = $0 nf = substr(fn,1,length(fn)-4) while ((getline x < fn) >...
  15. flogrr

    Fields are in different locations

    Hi rscotty, If your first 4 fields can be counted on to be static, then, this should work for you. I tested it on your short snippet of input and it seems to do what you want. I set it up to be comma delimited, of course! awk 'BEGIN{FS=&quot;,&quot;} { for(i=5;i<=NF;i++) if($i...
  16. flogrr

    Two character record seperator

    Hi Richardii- Is this what you need? If this does not work, please post a snippet of both input and the desired output. awk ' { count = split($0,arr,&quot;);&quot;) for (i=1;i<=count;i++) print arr[i] }' input > output HTH flogrr flogr@yahoo.com
  17. flogrr

    stringing output to same line and multiple lines if NF&gt;x

    Hi cconsum- Try this one-liner. awk '{ NR==1 ; if( NR % 24 != 0 ) printf(&quot;%s,&quot;,$1) ; else print $1 }' input > output HTH flogrr flogr@yahoo.com
  18. flogrr

    Input line too long message

    dbmsguy- You can ftp the file from this site: It will be called gawk306x.zip or similar. Launch the gnuish.htm for more info. ftp://ftp.simtel.net/pub/simtelnet/gnu/gnuish flogrr flogr@yahoo.com
  19. flogrr

    Input line too long message

    Hi dbmsguy- You might try using gawk. It has no arbitrary limits except the amount of memory available. Standard awk and even the later versions (nawk, mawk, etc.) have fixed limits on record size. Do a search on the net for gawk. There are several sites that offer zipped executables. I...
  20. flogrr

    Reading line format characters in /etc/printcap

    Hi gawker- A control I (^I) is a tab. You can use octal code 011 in your substr.....thus: /\011/ HTH flogrr flogr@yahoo.com

Part and Inventory Search

Back
Top