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 strongm 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. grazinggoat

    how is sed generating .2.

    I have files that are log.20170321PDT 8 numeric spaces and log.2017032307PDT 10 spaces the script does a conversion to add seconds to the time stamp to keep them unique when zipping but for some reason sed adds the extension below I'm at a loss on where the .2. is being genrated by sed any...
  2. grazinggoat

    regex to find invalid characters in filename

    I am trying to move files that have invalid characters out of a directoy but the regex i am using is still copying the good files that i want to keep in the log_dir files can be like this bill-0001.log BILL-0120-.log Bill-A-1234-Nov.log The problem is those files are still being moved can...
  3. grazinggoat

    printing/echo variable issue

    Hello, I have a script written in korn shell that I am having trouble to read my variables into an http line that. I've tried placing "\" in from of the variables but when the script runs it doesn't add whats being read in. Can anyone suggest the proper way to get these 2 variables to...
  4. grazinggoat

    Help with character sort

    I have 30 various channele split into groups serv1g1s1 dbserv100g5s1 serv1g4s2 dbserv20g15s6 I want to be able to break the list down by the groups (ie g1s1, g4s2, g5s1, g15s6 ) how can i sort when there can be any number of characters before the g, inbetween the s? I only want the list to...
  5. grazinggoat

    help with understanding array

    Can someone explain why the array is being put back in itself? I don't understand why this needs to happen FILE_ARRAY[ $(( IDX )) ]="${FILE_ARRAY[ $(( IDX )) ]} ${FILE}" set -A FILE_ARRAY (( IDX = 0 )) ; (( COUNT = 0 )) for FILE in ${FILES} ; do...
  6. grazinggoat

    have awk grep 2 variables

    I'm trying to parse the following I want to get a total of UP/DOWN from doing a status: apps_status sys1 UP sys2 UP sys3 DOWN sys4 UP right now I am doing app_status |awk 'NR>1 { r[$2]++ } END {for (i in r) print r[i], i}' how do i grep on up and down to feed into NR ? so that I have...
  7. grazinggoat

    case question

    Looking for thoughts on good programming... in my case i want to be able to do both a stop and start with the restart call. is it wise to have my var RUNCMD for both calls ? case ${COMMAND} in stop) RUNCMD=stop ...
  8. grazinggoat

    output awk print horizontally

    Hello I did a search of the forum but couldn't find my answer. I'm tracking parent and child processes that I want my child pids to be listed horizontally instead of vertically. I attempted to insert a tab but this is not working. MYPID="$$" echo "PPID: ${MYPID}" CHILDPIDS=$(ps -ef -o...
  9. grazinggoat

    Kill parent process and ALL child processes (if any)

    Greetings Folks! I have a script that kicks off multiple threads that I would like to make sure if say I do a cntrl-c (the script is force aborted) will not only kill the parent PID but any sub process? any thoughts on how I can do this where the script knows its been terminated? I've been...
  10. grazinggoat

    need to ignore file if search pattern found with a # comment

    Hello, I want to search a directory for a pattern and if its found with a comment to ignore the file but i want the return code or value. the reason is after checking for the pattern if its not a commented line i want to grab the lines from the file if its commented I don't want to know about...
  11. grazinggoat

    sort not sorting

    I am attempting to sort the contents of a file by the 5th position. the file is in this order: 0:1:2:3:server1a2:5:6:7 0:1:2:3:server4a2:5:6:7 0:1:2:3:server8a2:5:6:7 0:1:2:3:server1a2:5:6:7 it should output: server1a2 server1a2 server4a2 server8a2 But it returns the same order that in the...
  12. grazinggoat

    move () stumped

    Happy New Year Guru's! :) I am having a problem with my script renaming/moving files the move() and also tried rename() doesn't seem to like the .gz after i compress the file. when i run the script it gives A.log20120118053018PSTgz Any thoughts? Here is what I am doing: $A_Log =...
  13. grazinggoat

    find a process holding a file open

    anyone know of a possible perl builtin / function that will show a process holding a fileopen. I looked thru stat and lstat but still unable to find something similar to lsof. Any suggestions? Thanks
  14. grazinggoat

    calling outside script into perl mv()

    Hello Gents! I'm trying to move gz files to gz files adding a timestamp at the end of the file using an already written ksh script the ksh script is called fstamp here is what i'm doing : move( $File.gz $File.`$BIN/fstamp`.gz ); However I am getting the following syntax error: Can't call...
  15. grazinggoat

    qx not find file with full path name

    When i execute the script I get the following error: ./run.pl sh: ls -l /tmp/var/a.log: No such file or directory sh: ls -l /tmp/var/b.log: No such file or directory sh: ls -l /tmp/var/c.log: No such file or directory Seems its bombing on the qx but why wouldn't it find the filenames they...
  16. grazinggoat

    logic help for newbie

    Hello Need a little point in right direction.. I have a list of filenames stored in a txt file that I want to copy from 1 machine to another and check that they copied based on doing keeping track by file id and then a comparison of the filesize to make sure they match afte the copy. Could...
  17. grazinggoat

    using mkdir ()

    I'm a perl newbie... Can anyone tell me why mkdir will not allow me to make /tmp/system/logs. How do I get around this.. do I have to call mkdir by system? I suspect its because I would need mkdir -p but still couldn't get it to create. thanx in advanced #!/usr/bin/perl $ArchiveRootDir =...
  18. grazinggoat

    add a single char without over duplicating a string

    Hello, I've tried this with (off topic sed) but could not get it to work. Is the a method in awk so that i can take a line like this: a ba baa aab ab aaa aa a bab aba to get this: aa baa baa aab aab aaa aa aa baab aabaa basically when ever there is a double aa ignore it but add a a where...
  19. grazinggoat

    horizontal sorting

    thread271-1560325 When I run the awk I get the following error: cat /etc/group | awk -F':' '{split($4,a,","); asort(a); printf "%s",$1":"$2":"$3;y=":"; for (i in a) {if(a[i]!=x)printf"%s",y a[i];x=a[i];y=","} > printf "%s",$1":"$2":"$3;y=":"; > for (i in a) {if(a[i]!=x)printf"%s",y...
  20. grazinggoat

    escape single tic '

    this is more a sed question I am trying to remove a single tic from around a word in a file.. 'word' I'm doing the following: sed 's/\'//g' nfile > ofile But its not reading. Trivial but I'm having no luck. thoughts please?

Part and Inventory Search

Back
Top