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 gkittelson 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. Czar24

    Check to see if a file exists

    Hey all, I'm writing a program which saves the output to a single file like "output.txt" I've been playing with the ios::nocreate and ios::noreplace but I can't get it to quite do what I want it to do (and yes I've included the #include <iostream> to activate them. What I'm trying to do is...
  2. Czar24

    Another challenge: Having awk determine file type?

    The second part works like a champ. Thanks Salem!
  3. Czar24

    Another challenge: Having awk determine file type?

    Is this possible? I want to have my awk script check to make sure the input file is a text file? I've been having a heck of a time trying to do this. I've been trying variations on the system command such as: (system("file " FILENAME)==*"text"*) to no avail. Any ideas? Thanks in...
  4. Czar24

    extracting lines before and after pattern.

    I was working something along those lines, but was afraid it would have caused errors, but alas this works like a champ! I'm getting some other unexpected outputs now, but it's something I can quash pretty quick! Thanks again CaKiwi!
  5. Czar24

    extracting lines before and after pattern.

    Here's what I'm trying to do. I'm printing a pattern out of a source file by matching it using: nawk' . . . /start_string/,/stop_string/{print > output.file} . . . ' input.file Sample input.file . . . 1111blah 1112blah 1113blah 1114header information 1 1115header information 2 1116blah...
  6. Czar24

    Easy way to print to a file in a subdirectory?

    Ygor, that worked! Thank you very much. Vlad, thanks for the idea for streamlining the code, I'll working on that now too! Having to account for all my "{}"s Scott
  7. Czar24

    Easy way to print to a file in a subdirectory?

    I can create the file and long name in the current directory without issue. It only gives me greif when I try to place it into a subdirectory.
  8. Czar24

    Easy way to print to a file in a subdirectory?

    Okay, still stuck... Here's the file I'm processing with my awk/nawk code: 11111111111111 dont want 11111111111112 start.*101-01 11111111111113 file 1 text 11111111111114 stop 11111111111115 dont want . . . What the code is supposed to do is create a file called...
  9. Czar24

    Easy way to print to a file in a subdirectory?

    I thought I must be close. I tried what vlad had, exept for the ()s. I'll try that when I'm back at the office and let ya'll know how it works... I don't feel too bad since I was close on my first try at it, but alas, close only counts in horseshoes, hand grenades, and slow dancing -- but not...
  10. Czar24

    Easy way to print to a file in a subdirectory?

    In my awk script I would like to print a file to a subdirectory created by variables. instead of the command {print >> file} to print to a file in the current directory I'd like to send it to: /subdirectory1/subdirectory2/file where subdirectory1 and subdirectory2 are previously defined...
  11. Czar24

    Another AWK pattern matching issue

    Futurelet- I don't need ++prefix when it's all said and done. I was using that to simulate the incrimenting numbers for creating several files. I'm new to the whole awk thing, and my programming skills are rusty so I neglected to clean that up before I posted. That code got me close enough...
  12. Czar24

    Another AWK pattern matching issue

    I have another problem. I'm trying to extract a string to be used as part of a new file's name. For each type I know either the format of or the placement of the text. I can't use $1 for pulling out the numerical reference since there may or may not be a space at the end of the character...
  13. Czar24

    Help with CLOSE command in AWK

    Jean Pierre- That worked! Thanks a million!
  14. Czar24

    Help with CLOSE command in AWK

    Still getting the file limits... could this be something with my system?
  15. Czar24

    Help with CLOSE command in AWK

    Jean Pierre, thanks for the quick response! but I'm still getting the same problem: awk: too many output files 10 record number 42 If it matters, I'm running Korn Shell. Here is my modified script, sould be identical to yours unless I'm missing something: awk ' BEGIN{prefix=100 }...
  16. Czar24

    Help with CLOSE command in AWK

    Hey all, newbie to awk here. I'm trying to write an awk command that will split test out of a larger file and put it into smaller files based on start and stop sequences. I'm running into the system limitation of 10 files open and can't get the close() command to work. Any help is...

Part and Inventory Search

Back
Top