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 TouchToneTommy 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: mwesticle
  • Content: Threads
  • Order by date
  1. mwesticle

    count pipes ("|") in a file

    I need a simple nawk, awk, or sed program (or anything else, really) that will count the number of pipe characters in a file. So, if my file looks like this: 222222222222222|2222|2222|222222||| |222222|222|222222222222||222| |||22222222|222222222|2|||222222222222| I need the program to return...
  2. mwesticle

    Need a Command (or Program)!!!

    I have a pipe-delimited file with 24 fields. It is sorted on the 24th field. I need a program (or command, awk, nawk, whatever) that will go record-by-record, and flag every record where the 24th field is the same as the previous record AND field 19 is DIFFERENT (from the previous record)...
  3. mwesticle

    awk, nawk???

    Hi. I have a fixed width file, that is 62 bytes wide. The first 50 bytes are irrelevant to me. Bytes 51-62 are what I'm interested in, here. Starting in position 51, there is a number that is one to 12 bytes wide. I want to alter the file, padding any non-12-byte number with zeros, to fill...
  4. mwesticle

    MMS API

    Hello, I have a question that someone here, hopefully, can answer... My project team at work is developing a java-based product that will automatically send email messages, SMS messages, and MMS messages in real-time. We are dealing with brokers to handle the sending and receiving of email...
  5. mwesticle

    Easy UNIX file question...

    I have a fixed-width file that contains records that are 20-bytes long, and 12 of those bytes make up an "individual id" field. the remaining 8 bytes contain "other" information. The "individual id" may or may not be unique across records. So, for example, the contents of my file might look...
  6. mwesticle

    Select Records (awk, nawk, sed???)

    I need to select certain records from a file. The records are pipe-delimited, and therefore variable-length. The last two fields on the record are the onew I am concerned with. I want to pull records where the 2nd-to-last field = 'Y', and the last field = 'N'. For example, out of these four...
  7. mwesticle

    Join two files (sort of)

    I have an easy to semi-difficult problem here, and I was wondering if any of the good people at Tek-Tips could help me out... Here goes: I have two files (File A and File B), each have records that are 100 bytes in length. There are 12-digit "keys" on each file, in positions 1-12. File A is...
  8. mwesticle

    append two pipes ('|')

    I have a file that conatains roughly 700,000 records. I need a quick way to append two pipe characters to the end of each record. So, If input looks like this: aaa|bbb|ccc aaaa|bbbb|cccc nnnnnnnnnnnnnnnnn Output needs to look like this: aaa|bbb|ccc|| aaaa|bbbb|cccc|| nnnnnnnnnnnnnnnnn||...
  9. mwesticle

    find the longest record in a file

    I need to run something ('awk', 'sed', etc.) that will let me know what the longest record in a file is. And I need it to ignore spaces. So, if I have a file with records that look like this (without the ticks): 'John Doe' 'Al Doe' 'Christopher Doe' 'Jill Doe' I want the returned result to...
  10. mwesticle

    insert header into a file

    Very easy question here: I have a file that contains pipe-delimited data. I need to insert a header record, without overwriting any data records. So, if the input file looks like this: John Doe|123 Main St|New York|NY|10101 Jane Doe|456 Oak St|Chicago|IL|12345 I need the output file to...
  11. mwesticle

    convert fixed-width file to a pipe delimited file

    Hi All... I have what is probably a very easy question for the experts that patrol this board... I have a fixed-width file with four 10-byte fields (field 1 = bytes 1-10, field 2 = bytes 11-20, field 3 = bytes 21-30, field 4 = bytes 31-40). Some of the fixed-width fields contain no spaces, or...
  12. mwesticle

    'awk', nawk', sed'? Not sure

    OK. Here's my dilemma... I have a file with a bunch of 12-byte "ID's" on it. It looks like this: 111111111111 999999999999 222222222222 999999999999 333333333333 222222222222 ...and so on. Anyway, here's the criteria: I want to take this file, do "something" to it, and, when that...
  13. mwesticle

    remove trailing spaces from records

    If I have a file where all of the records have trailing spaces... like this (without the single quotes): '123 Main ' '456 Central Ave ' '789 Oak Street ' How do I take this file, and strip the trailing spaces, so my output looks like this (without the single quotes): '123 Main'...
  14. mwesticle

    pull records from a file based on a condition

    Hi... What's the best way to pull a record from a file if certain bytes match a string? For example, I have a fixed-width file that has a state code in the 200-201 byte of each record. I want to pull all records where state code = 'CA' 'NY' 'NJ' or 'FL', and put them into a new file. How do...
  15. mwesticle

    append a sequence id to all records

    Hi... I have a fixed-length file, and I need to append a 38-byte sequence id (starting with '00000000000000000000000000000000000001') to the beginning of each record. I know there is an easy way to do this using a korn shell script, but I can't remember it. Can anyone help me out here? Thanks!
  16. mwesticle

    MS WORD - Insert "Help" Text???

    I'm creating a Word document that will be used for requirements gathering. There are several sections the end user will be required to fill out ("Specifications", "Constraints", etc.). I want to try something, and I'm not sure it's possible. Under each section heading, I want to provide the...
  17. mwesticle

    Protect only "Form" part of document (MS Word 2002)

    I have a document I'm trying to put together using MS Word 2002. In the top fifth of the document, I have a table structure, containing some fill-in forms ("Name", "Date", etc.). In the bottom 4/5 of the document, I have no real formatting, but I do have section header names ("Requirements"...
  18. mwesticle

    .ksh scripting question

    I'm trying to write a .ksh script that will take an input file that contains records that are 10 bytes long, and then, based on the first character, append an eleventh character. If the first character of the record = 'H', I want the script to append an 'A' to the end of the record (as byte...
  19. mwesticle

    Selecting record based on a condition

    Hi... I have a file that contains name and address information. The primary address appears from byte 116-150. I need to pull all records off of that file where primary address is NOT blank, and put them into a new file. Can anyone help me out here???
  20. mwesticle

    cutting spaces where there are none...

    I have a file that contains a 10 byte sequence number, followed by a 1 to 3 byte segment id. My file looks like this (without the single quotes): '1234567890A' '0987654321BB' '1111111111CCC' So, as you see, some records are 11 bytes in width, some are 12, and some are 13. I want to use...

Part and Inventory Search

Back
Top