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 Shaun E 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: frangac
  • Content: Threads
  • Order by date
  1. frangac

    ARGC question

    Hi All, Can I use a for loop to read the ARGC input parameters instead of me using ksh to do this for e.g. Chris.sh NE DT 20061105 20061106 and must read BEGIN{for (i=1;i<ARGC;i++){ if(ARGV[i] != 4){ exit 1 } else { $1=NE ,$2=DT etc.. } Many Thanks Chris
  2. frangac

    Print Line

    Hi All, PHV How can I print the getline statement from the following: awk -v opt=Restore_Chris -v PH='/raw_data/SB/repdir/Archive_Restore/' 'BEGIN{print "connect tcenh198 dsadmin \"\""} /MTA0000001/{print "compRead...
  3. frangac

    The while loop

    Hi All, PHV Below is my script that reads the .ini file and if the start time is 12:00 is should them activate the instance which it does but due to the data base allready marked as active , it returns a "MESG" But when the next instance (conductor_DCAPS_E10_12) is read it does the system...
  4. frangac

    If pattern is not available, print a mesg

    Hi All, The problem that I am experiencing is when the pattern is not found in file2, print a mesg "0133333333 No Info Available". I have tried different ways but cannot seem to find a solution. My Code awk 'BEGIN{printf "%10s %25s %20s %15s\n","A_NUM","DATE/TIME", "B_NUM","DURATION"}...
  5. frangac

    System() with sprintf

    Hi All, How can I call a sprintf command to read the following selcmd1=sprintf("%s","echo select A_NUM=nullif\(A_NUM,\\\" \\\"\) R_DT=date\('2006/06/06'\) "\\\\ngo | " opt) in other words the result must return like : echo select A_NUM=nullif\(A_NUM,\" \"\) where R_DT=date\('2006/06/06'\)...
  6. frangac

    Reading each number in array

    Hi All, How can I do the following number = 0123456789 By using the for loop for (i=0;i<=length($1);++i) { assign each number to an arr } ' $1 and the result arr1=0 arr1=1 arr1=2 arr1=3 arr1=4 arr1=5 arr1=6 arr1=7 etc... Many Thanks Chris
  7. frangac

    Joining two values

    Hi Salem and all, How can I cat two bytes which is read in as char and then converted in hex, for e.g. If I read the first byte (char) and then covert it to hex (26), read the next char and convert it to hex (ac). Cat the both should be 26ac , then only print the decimal value. Is my logic...
  8. frangac

    strcat help

    Hi All, I am new with c and would like some help. When reading a bin file the year is 06, the decimal value = 6 so I use the &rawtime to determine the year and then cat it with the array (xya[j]) so that the result will printf 2006 and do this with the month as well as the day. How can I strcat...
  9. frangac

    Trying to read a file

    Hi All, PHV I am stuck with the following or if there is a better solution please post. What I am trying to achive is to read a bin file with "od" 0000000 4837 7470 722b 3a30 3964 7331 3753 4654 0000020 3030 3030 6161 6161 6161 6161 6161 6161 0000040 6161 6161 6161 6161 6161 3781 0000 0000...
  10. frangac

    Can awk open a bin file

    Hi all, In order for me to complete or ask any questions with my script, I was wondering weather awk can read a bin file, just like perl can using the "open" cmd and if so how can this be done. Many Thanks Chris
  11. frangac

    Find Pattern and then sub the next 3 or 4 lines

    Hi All, PHV What I need is to find a pattern 128 then count 32 lines read $2 which is 20060212092325 prompt the user to which date would he like to change to, change the date to the reply but at the same time read reply then substr date into : Y_R=substr(reply,1,4)...
  12. frangac

    Reading the third file and sub

    Hi All, Below is the code which I am busy with but am stuck with trying to read the third file. What I would like to do is to use (this value------->) as indicated below and sub into the third file Can anyone assist me with this issue. awk 'FNR==NR {...
  13. frangac

    Compare two files

    Hi All, How can I compare two files for eg if line in filea is not in fileb print "filea Diff in" and if line in fileb is not in filea print "fileb Diff in". The below code will work if I put fileb as the first file and filea as the second awk ' NR==FNR{a[$0];next} {if...
  14. frangac

    If pattern is not found

    Hi, Below is my code which the output I receive is not what I expect. What I need help in is when /[a-z]:/ is not found print a mesg and then exit or else if pattern is found, print certain columns as required. awk '{if(!~/:/){ print "No Errors were Found for `date +'%Y%m%d'`" } else {...
  15. frangac

    AWK reads two files

    Hi All, Is there a way in which AWK reads two files, get a result from each file, and then subtracts file1 result from file2 result. e.g. x=/= "RM_[0-9][0-9][0-9][0-9][0-9]/{print substr($3,2,10),substr($3,7,5)}' from file1 y={if($1~/^IP/ && $9~/M_[0-9]/){print...
  16. frangac

    Print a statement if no values are found

    Hi All, My code, awk '/:/{ if($3>20) { DATE1="date +'%Y%m%d-%T'" DATE1 | getline DT close("DATE1") name=substr($2,1,7) Date=substr(DATE1,1,8) Da_T=substr($2,8,11) VOL="/data/Gaps/"Da_T".txt" {if((name~/eplz/ &&...
  17. frangac

    Determine which year to use with julian dates

    Hi All, Below is a script from CaKiwi, If I am reading a file that is dated 20041225 with Julian date 360, which uses the current year (2005) to determine if it is a leap year("date +'%Y'" | getline yy), and then returns the wrong date format which I understand why this is being done. My...
  18. frangac

    substr Question

    Hi All Is there any explanation as to why the SQL1 statement (substr) takes longer than the SQL2 statement? They are both index the same. SQL1 select count(*) from CE.CDR_DRMS where substr(FE_F,9,8) >= '20041001' and substr(FE_F,9,8) <= '20041001' and STAT_CODE like 'r%'; SQL2 select...
  19. frangac

    Merge two files with comparison

    Hi All, I have two files. First file "Chris1.txt" ckb+:05 17468668 ds09 ckb+:05 1549368 ss09 cup+:03 3654311 ds09 cup+:03 266059 ss09 eel+:04 15392852 ds09 eel+:04 944131 ss09 Second File "Chris2.txt" ckb+:05...
  20. frangac

    What if pattern does not exis?

    Hi All,PHV, Below is a script which PHV assisted me with. My question is what if the file does not constist of /^128 A/, it should exit with a print statement. My suggestion is to getline (first line), if $0!~/ AT 1.1 LV 1.1 then exit. Check if output file is "-s" and if not true, use the rm...

Part and Inventory Search

Back
Top