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 Chriss Miller 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: cptk
  • Content: Threads
  • Order by date
  1. cptk

    XSD Schema - use the name of xml file within the xsd rules?

    I'm a newbie ... Within a xsd schema, I'd like to know is it possible to apply a different rule based on the actual name of the xml file I'm validating? For example, a specific tag (eg. <devUse>) is valid only for xml files that contain "debug" in their actual xml file name. If the xml file...
  2. cptk

    Regexp Help

    string = "id <xx> MM blah blah" 'MM' is a optional value in string ... If 'MM' exist, I want to capture contents seperately both before and after 'MM'. If 'MM' doesn't exist, just capture the entire string. examples: If 'MM' exist ... /(.*)M{2}(.*)/ $1 = 'id <xx> ' $2 = ' blah blah' This is...
  3. cptk

    Positive vs. negative look behind pattern search

    When running the following 2 lookbehind zero-width assertions : /(?<!\S)dog/ ##Match a non-non-whitespace char /(?<=\s)dog/ ##Match a whitespace char ... why would I get different results? That is, the first lookbehind will match if "dog" is at the beginning of the line, the 2nd lookbehind...
  4. cptk

    Redirecting output, can I get actual name of file?

    Say I'm executing from the cmd line... myprogram > RDfile Is there a way to reference the actual redirected file name 'RDfile' in the ksh script? Built-in shell variables like $* or $@ don't include any of the tokens right of the ">" cmd. What about referencing the file descriptor ... how...
  5. cptk

    grep -w and the effects of special characters

    Using the -w option doesn't necessarily return a whole word. For example, if I run /usr/xpg4/bin/grep -w "bird" myfile, "birdie" will not be returned, but any of the following will: bird# bird@ bird$ ..etc. This will cure it, at the cost of longer execution time. grep...
  6. cptk

    Matching Alternative Patterns slows down search tremendously!

    Using something like ... @matched = grep /ABC/g, <FILE>; On a single 16,000 line txt file takes only 0.7 seconds. but, if I add ... @matched = grep /ABC|XYZ/g, <FILE>; On a single 16,000 line txt file takes 17.0 seconds. Why would adding a alternate pattern sequence cause such an increase in...
  7. cptk

    Can I use a variable for the modifier in a match ??

    if ( $name =~ /$sp/i ) ### works as expected ...but I want to instead use: my $cs="i" if ( $name =~ /$sp/$cs ) ### can I somehow use a variable for the modifier? PS - I don't want to convert everything to a specific case -i.e. - \U
  8. cptk

    sort by specified field(s) doesn't work as expected !!!

    I'm using ksh in Solaris ... Say I have a simple 4 line file: 30 XB A 30 XB B 30 XB C 30 XB A I want to sort on the 1st column only and not have another column (i.e. - 3rd column) influence my result: I run something like... sort -k0,1 file ...but, my return result is always: 30 XB...
  9. cptk

    GetOptions and wildcard Argument

    Using Getopt:Long ... Is there a way to correctly capture all the files return if the cmd line arg contains a wildcard? e.g., -f *.dbg ? Since the shell expands the wildcard prior to perl, double-quoting "*.dbg" will resolves this, but sometimes the users don't always use double-quotes. I...
  10. cptk

    How to Remove a pattern (from the right)

    In ksh, ${var%%pattern} %% will remove the longest matching pattern from the right. % will remove the shortest matching pattern from the right. so if ... var="abc7xyz" echo ${var%7*} ## would display "abc" How would I do something like this in perl?
  11. cptk

    size of an array inside a hash

    How do you get the size of an array inside a hash in 1 step? this works (2 steps): $cnt=@{$hash{$key}}; print "cnt is: $cnt\n"; But if I want to do it in 1 step (print): print "cnt is: @{$hash{key}}\n"; this doesn't work - it returns all the array elements ...
  12. cptk

    Hash of arrays - problem adding to the array

    If'm testing to see if initially the hash's array value is empty. If it's not, I want to push a string value to the array. I'm getting an error when I printing out the hash array values: "can't use string ("2") as an ARRAY ref while "strict refs" in use". This simple code works if I don't...
  13. cptk

    Newbee Questions - Hash of Hashes / data structures

    24 hours into my 1st Perl coding, and I'm jumping right into data structures. I'm testing conceptual stuff 1st.I have some questions: 1.) is the line "my %byaid" defined correctly? 2.) where I use "undef"'s, is this right? 3.) why am I not getting what I expect in the output? Please go easy on...
  14. cptk

    Turn off file expansion for command line arguments

    I supply a script with cmd line args ... e.g. somescript -a *.msg When I echo the cmd line arguments in the script: echo "$@" or with echo "$*" (I want "-a *.msg") Using a "set -f" within the script has no effect on the cmd line arguments. However, if I use a "set -f" at the command prompt...
  15. cptk

    Returning the actual value from a simple unix cmd

    Is there a simpler way/method to get the return value from a unix cmd then to use the following method: FILE *in; char cmd[5] = "pwd"; char buf[100]; in = popen(cmd, "r"); fgets(buf,100,in); /* or use some form of fscanf(in,%s,buf); */ pclose(in); It seems that "popen" is the only way to get...
  16. cptk

    sscanf problem

    I want to test the "time_str" to see if it's has the correct format. The format should be "##,##,##" int hr, min, sec; if sscanf( time_str, "%i %*[,] %i %*[,] %i", &hr, &min, &sec) !=3) If a user enters for "time_str" something like: 02x,05,05 or 02,05x,05 the conversion will fail based on...
  17. cptk

    Possible to removing directory names while tarring?

    Is there a way to tar-up a directory containing sub-directories so that the resulting tar file just contains the file names from the sub-directories and doersn't include the name of the sub-dirs? e.g.: > /test/one/file1.txt > /test/two/file2.txt and run something like ... tar -cvf final.tar *...
  18. cptk

    dtterm &amp; menuBar

    I can turn-off the scrollbar ... > dtterm +sb BUT, I can't turn-off the menuBar ... > dtterm +menuBar ...or.. +mb This is in solaris 9 ...
  19. cptk

    exec a shell with a cmd from another shell and keep it open?

    I can ... > exec dtterm -title "mytitle" -e ls -la but in doing so the new shell closes when the cmd is completed plus it closes the the calling shell! If I ... > eval dtterm -title "mytitle" -e ls -la , at least the calling shell doesn't close. Is there a way to keep the new shell open...
  20. cptk

    How to suspend Workbook_Open code from running when opening file?

    Is there a way to suspend the "Workbook_Open" code from running when opening a file?. e.g.- like hold the ctrl down or some other key combinations?

Part and Inventory Search

Back
Top