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 SkipVought 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: *

  • Users: booke
  • Order by date
  1. booke

    Parse file and evaluate line - Complicated!

    Does this help at all... awk -F"<fsp>" '{print NF}' #All lines above show 16 fields awk -F"<fsp>" '{print $10}' #Prints TimeInventoryUptime
  2. booke

    sort awk

    Sorry Malpa, there should have been an opening curly brace after -> while(getline TMP2 > 0) {
  3. booke

    sort awk

    Would this be correct ... ls -ltr /your/dir # This puts the files in the correct sort order. The starting file number would be the first substr of $NF and the ending file number would be the last file shown in the listing - Correct ??
  4. booke

    sort awk

    Please take a look at this and see if I am understanding you. Am I on the right track? ls -l /your/dir | awk '{print substr($NF, index($NF,"_")+1, 4)}' | sort +0n | awk 'BEGIN {getline TMP1; while(getline TMP2 > 0) if(TMP2 > TMP1 + 1) for(i=TMP1+1; i < TMP2; i++) print i; TMP1 = TMP2}}'
  5. booke

    Parse and sum part of a field

    awk '$NF ~ /m:/ {TOT += substr($NF, 1, index($NF,"m:")-1)}; END {print TOT}'
  6. booke

    Formatting output from lines

    Try this: awk 'NF == 0 {next}; {if($0 ~ /^[0-9]/) {TMP1 = $0; if(getline TMP2 > 0) print TMP2":"TMP1}}; {if($0 ~ /^[a-z]/) print $0":"}' /filename
  7. booke

    Multidimensional array help

    awk ' {myarray[$1 $3]} END { n=asorti(myarray) for(i=1; i<=n; i++) print length(myarray[i]), myarray[i] }'
  8. booke

    parse file AND parse column with diff delimiter

    You could: awk -F"|" '{split($NF,a,"/"); print $1"|"a[4]}' your_filename
  9. booke

    Match two file using grep and awk

    Here's a way to get what you want: This is my first post, so here's hoping I do this correctly... for name in `awk 'NF == 3 {arr1[$1,$3] += 1}; NF > 3 {arr1[$1,$4] += 1}; END {for(i in arr1) if(arr1[i] > 1) print i}' data1 data2` do awk -v N=$name 'BEGIN{sub(/[\034]/,"",N)}; NF==3 && $1$3...

Part and Inventory Search

Back
Top