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: dchoulette
  • Order by date
  1. dchoulette

    how to "cat" text to the beginning of a file?

    mv file file.orig && cat prefixfile file.orig > file -------------------- Denis
  2. dchoulette

    Using ssh to run multiple commands

    You do not need to do the filtering on the remote host. Just do the ps remotly and the rest locally : num=`ssh userName@remoteBox 'ps -ef' | grep userName | grep -i processName | grep -v grep | awk '{print $2 }'` -------------------- Denis
  3. dchoulette

    Help adding newline

    Are you writing and reading your file on the same computer ? -------------------- Denis
  4. dchoulette

    Counter and # of output lines not equal and should be

    What are the values for @last4months[0..3] and $rpt_month ? Could it be possible that $rpt_month equals one of the last4months ? -------------------- Denis
  5. dchoulette

    deleting data and merging data

    You could try: sed 's/^"//;s/"$//' | awk -F '"?,"?' in the first example given by p5wizard. The sed suppress any " at start or end of line and the -F in awk allowed for optional " before and after the comma. This simple trick would not work if there is any comma or escaped quotes inside the...
  6. dchoulette

    Archiving script

    No need to backquote the ls: you don't want the output of ls, just its exit code (ls returns an error if a file does not exist). Just remove the standard and error outputs and check the return code (it's what if do): if ls *.log >/dev/null 2>&1; then : # Here at least one .log file exists...
  7. dchoulette

    Awk with if statements

    awk '/Availability|Reboots/,/Bluescreens/' -------------------- Denis
  8. dchoulette

    Combining Shell Variables

    Use eval ! The command export has an (unwanted) side effect: it exports the variables. Besides, eval also allows you to get/use the values using constructed variable names: eval echo \$CLIENT${COUNT} -------------------- Denis
  9. dchoulette

    ftp error at '<<'

    ... unless you put a dash '-' just after the '<<'. In this case all TABs (and only TABs) are stripped from the start of the following lines before they are used (either for checking against the 'EndOfHereDocument' string or as input for your command) for arg in "$@" do ftp -n -i -v <<-SCRIPT...
  10. dchoulette

    Help with SED, creating script from file list

    If not for the speed problem you speak of in your other thread thread822-989438 (and I do not know if this is so much un issue), it could be so much simpler with tar. You could directly use the fileList.txt # backup (cd /; tar cf - -T fileLst.txt) | (cd /backuploc; tar xf -) # restore (cd...
  11. dchoulette

    finding out the number of splits

    You do not even need this @splitarray variable: $lastField = (split / /, $tmpholder)[-1]; -------------------- Denis
  12. dchoulette

    awk -- get last field

    Just empty the unwanted fields then print: ls -lTp | awk '{$1="";$2="";$3="";$4="";$5="";$8=""; print}' -------------------- Denis
  13. dchoulette

    compare hash keys originating from different files

    #!/usr/bin/perl -w use warnings; use strict; use locale; open FILE1, "file1.ans" or die; open FILE2, "file2.ans" or die; my %orig; my %orig_from_lc; my %to_be_used; while (<FILE1>) { chomp; my ($orig, $punct)=split /\t/; $orig{$orig}=$punct; $orig_from_lc{lc $orig} = $orig...
  14. dchoulette

    Sorting a Linked List

    Some reflexions about strcmp returning <0, =0, >0 instead of -1, 0, 1. As Salem said: both results are consistent, yes. But looking for positive or negative instead of 1 and -1 is more generic and will be true for all implementations. When in doubt stick to the manual. How many times did I...
  15. dchoulette

    SSH & SFTP accessing VMS Servers

    Yes, and after reading man for ssh and ssh-keygen, you could also read man for ssh-agent and ssh-add. -------------------- Denis
  16. dchoulette

    Sed syntax

    Vlad, this is about removing from /word/ to end of file and you print from /word/ to end of file. Try this: sed '/word/,$d' -------------------- Denis
  17. dchoulette

    help on unix script

    paste - - < file -------------------- Denis
  18. dchoulette

    for i in `ls`

    There could be a limit on the length on the string that can be returned by a backquote commande or a limit on the length of a command (here the for i in command). There could be non directory entry in dirX (simple files). Also, there could be a problem if any subdirectory has 'special'...
  19. dchoulette

    V. large file::stat returns negative number!

    I am off subject but I just want to add a little comment about this line: ($j,$j,$j,$j, $size, $j, $j, $j, $j) = split(" ", $_); You do not need this useless variable $j. You could just use the 5th field like this: ($size) = (split(" ", $_))[4]; The parentheses around $size used to force...
  20. dchoulette

    Date and Time

    As you said, on msdos, the command date and time without arguments let you change the date and time. Each of them expected you (so waited for you) to enter a new date or time and to press return to validate. No surprise then. -------------------- Denis

Part and Inventory Search

Back
Top