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 Mike Lewis 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. FlorianAwk

    script output to columns with headers

    I suggest: $ cat init.txt 050313094000 480 FIN_WAIT_2 050313094000 322 ESTABLISHED 050313094000 101 TIME_WAIT 050313094000 33 LISTEN 050313094000 9 CLOSED 050313094000 2 LAST_ACK 050313094000 1 CLOSE_WAIT 050313094000 0 SYN_SENT 050313094000 0 SYN_RECEIVED 050313094000 0 FIN_WAIT_1...
  2. FlorianAwk

    script output to columns with headers

    printf is your solution. netstat -an | grep tcp |awk '{x[$6]++;} END { for(i in x){printf "%s ",i};print ""; for(i in x){printf "%s ",x[i];print ""} }' |awk '{printf "%15s%15s%15s%15s%15s%15s\n",$1,$2,$3,$4,$5,$6}' 15 is the size you want to apply to each field. Good luck.
  3. FlorianAwk

    awk help on multiple files as input and output to multiple files

    I would put my awk script in a file named mytool.awk (with adding #!/usr/bin/awk -f and giving execution permission) Then, in a directory containing my csv files, i would just write: for i in *;do mytool.awk $i>$i'.html';done
  4. FlorianAwk

    Log awk execution

    Or make a print between each line of code Don't say "thank you
  5. FlorianAwk

    Displaying long integers

    1kB = 1024B 1MB = 1024kB 1GB = 1024MB = 1024x1024x1024B 1024 = 2^10 You should multiply by 1024 instead of 1000 to be precise.
  6. FlorianAwk

    Reformat Output to csv

    I doubt that the recommended output has anything to do with a csv file to import. I also doubt about 'idle' put after the destination. Is it a bad copy/paste? As PHV has said, precise your question.
  7. FlorianAwk

    Sub-totalling an array

    1) "hour" is extracted from a string. So it is a string. To consider it as a number (in order to format it), I would have use a command such as int() [edit] reading again your code, I mentionned you have 2 n. One for the loop and one to store the result of sprintf. This is not good.[edit]...
  8. FlorianAwk

    directory list

    First I was very surprised. Then I realised that your file has hidden spaces at the end of line. So you have to clean it, either directly, or by command (but it becomes long compared too the awk solution)
  9. FlorianAwk

    directory list

    sed 's/$/\./' /input/file |grep -vf - /input/file Result: /etc /root /var /home/
  10. FlorianAwk

    Break a file into multiple files

    awk '/GROUP/{print>$2".DAT"}' /input/file;for f in *.DAT; do grep ^H /input/file |cat - $f > tmp;cat tmp>$f;done
  11. FlorianAwk

    Extrract Column Names and Values from Text File

    How many files have you got ? It will be faster to modify each file yourself than by a script.
  12. FlorianAwk

    Script using ngrep looking for matches...

    The following command over the log file you gave works fine for me: sed '/^$/N;s/\n//;s/^input/\ninput/;s/\.\.\([^\.]\(\.\{0,1\}[^\.]\{1,\}\)\{1,\}\).*/ \1/;/^U/{s/U \([^\.]*\)[^ ]* \([^ ]*\) -> \([^ ]*\) [^ ]* /\1 \2 \3 /}' pcap.txt Result: input: /media/KINGSTON/test.pcap match...
  13. FlorianAwk

    pattern matching and print filename

    Dare I suggest: $ grep transfered *.txt ?
  14. FlorianAwk

    AWK output format

    First, your log is dirty. The result can be in the fifth column (SUCCESS) or the sixth column (FAILURE). Change it and you'll be able to use: awk -F";" '{num=0;cmd="grep -c "$6" file.log";cmd|getline num;close(cmd);printf "%-20s %s\n",$6,num}' |sort -u "-F" to change the separator "6" is the...
  15. FlorianAwk

    executing scripts in current folder

    If the pain comes from the point-slash, you have two more solutions: o alias. Example: alias goForIt="./goforit.bin" You place it in your ~/.bashrc not to retype it each time you restart. o place a symbolic link into your /home/user/bin directory. Example: ln -s /your/path/to/app/goforit.bin...
  16. FlorianAwk

    Ubuntu color escape codes

    To be clear, the line must be: color_prompt=yes isn't it ? and then: PS1="\[\e[0;34m\][\u@\h \W]\$\[\e[0m\] " should work
  17. FlorianAwk

    KORN Remove PID from FIlename

    Thank you very much.
  18. FlorianAwk

    KORN Remove PID from FIlename

    Is there somewhere any documentation about this powerfull syntax?
  19. FlorianAwk

    ubuntu configuration issues: gethostbyname & inet_ntoa

    What gives echo $HOSTALIASES?
  20. FlorianAwk

    Get second part of line with SED

    First, the suggested solutions won't work with: release 10.1 Or release release 4 (Nahant Update 9 extended) What about sed 's/.*release \([^ ]*\) .*/\1/' /etc/*release ?

Part and Inventory Search

Back
Top