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. quirkasaurus

    split

    are these threads moderated ? can we get rid of these useless "man command" comments?? my common method is one of these: cat input | tr ' ' '\012' or ### works for all non-printable characters. cat input | sed -e 's/[^ -~]/ /' \ -e 's/ */ /g' | tr ' ' '\012'
  2. quirkasaurus

    Delete words that aren't in all caps

    Try this: sed -e 's/[^A-Z0-9 ]//g'
  3. quirkasaurus

    grep challenge

    just add a dot: grep "com.*-asx" an asterisk by itself means any number of occurances of the previous character; in this case, "m".
  4. quirkasaurus

    using batch process to edit live crontab

    my answer would be not to mess with cron, but to create a go/no-go file somewhere on the system where the cron-job first looks before it executes. or put the decision to run/not-run in the script itself or a wrapper script. no reason to get fancy here.
  5. quirkasaurus

    Remove "�" from a string

    Try this: echo "GARBAGE" | sed -e 's/[^ -~]//g' | read new_var The sed search string basically is "NOT printable character
  6. quirkasaurus

    grab particular text from file

    My answer: cat << EOF | =============== 23-JAN-2008 10:26:40 * (CONNECT_DATA=(SID=P)(CID=(PROGRAM=C:\Program Files\Quest Software\Toad for Oracle\TOAD.exe)(HOST=A002168)(USER=ksmith))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.200.100.196)(PORT=1319)) * establish * P * 0 23-JAN-2008 09:41:31 *...
  7. quirkasaurus

    Help on variables

    LOGCONTENTS=`grep \`date +%Y-%m-%d\` | grep -i "[n][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"` cat /tmp/logs | ${LOGCONTENTS} > /tmp/test The answer is to simplify your script like so: date +%Y-%m-%d | read yymmdd cat /tmp/logs | grep $yymmdd | grep -i...
  8. quirkasaurus

    sed question

    <Device dev_name="0853" status="Ready" configuration="RAID-5"> I would use the following: grep Device | awk '{print $1}' | sed -e 's/"//g' | cut -d= -f2 This way it's very clean and every step is very straightforward.
  9. quirkasaurus

    Awk limit on aix3.2.5

    how's this ? I was puzzled by the fact that you set your RS and FS to the same character... But anyway, try this in a script: #!/bin/ksh file=$1 cat $file | tr '^C' '\012' | grep Sterling > GBPT # Then, same thing opposite: cat $file | tr '^C' '\012' | grep -v Sterling > NEWT # eof...
  10. quirkasaurus

    Newbie needs scripting help

    Jake99, Try this one, the first line must be the first line in the script: #!/bin/ksh # Go to where my files are: cd /target_dir/ # List all my files, pipe to my processing loop. /bin/ls -1 | while read file_nm ; do echo Processing $file_nm case $file_nm in *.dat) echo...
  11. quirkasaurus

    Problem in X-window on SCO-Unix

    Losing carriage controls is a common theme when messing around with emulators. I offer the following tips: Hitting CONTROL-J ~should~ still give you a carriage control. So you should be able to do things like: % ls CONTROL-J and get some results. Make sure that your &quot;export...
  12. quirkasaurus

    how to copy file say MO-CJ--p MO-CJ--c in a directory and then modify

    We like to split jobs like this into the 2 tasks that they truly are. Step 1: Rename the files: /bin/ls -1 MO-*-p | sed -e 's/\(.*\)p$/mv \1p \1c;/' | ksh You can test the command builder first without piping to ksh. Step 2: Edit the new files: /bin/ls -1 *c | head | while read file ...
  13. quirkasaurus

    UNIX command help needed

    And finally, in order to stop opening and closing your output file every time ( which definitely effects performance for larger tasks ), put the redirection on the outside of the loop ( available in ksh: #!/bin/ksh for i in $(ls price_file_pattern) do sort $i | head -12 | cut -d' ' -f1 done...
  14. quirkasaurus

    sed to remove carriage return

    Dickie Bird's solution didn't work on my computer, which is a sun box. Anyway, you can always create your own little script and add the control character in vi using the sequence: CONTROL V, CONTROL M When done, the script should look like: sed -e 's/^M//g' $input_file > $input_file.fmt Or...
  15. quirkasaurus

    *.dep file contains $(INCLUDE)

    I was attempting to build a porting program from MS to UNIX. I was reading the *.dep file in order to ascertain the -I include paths for compilation. Suddenly, MSVC++ decides to replace all directory paths with the string $(INCLUDE). I have no idea WHERE this is coming from, nor why it suddenly...
  16. quirkasaurus

    swap lines in a file

    One trick I didn't see here is worth mentioning, within a script you can use vi: vi $file << EOF :14mo26 :25mo13 :wq EOF Quick and simple.
  17. quirkasaurus

    Line numbers on a file.

    nl -ba $file | tee $file.fmt
  18. quirkasaurus

    ECHO PID

    In ksh and sh, the last process id put into background is stored in the environmental variable: $! In csh, I don't believe that's available except through some heroic grepping of the ps command. ps -deaf | fgrep $$ | etc....

Part and Inventory Search

Back
Top