what is a pipe delimited text file?

6 Answers

Relevance
  • Anonymous
    1 decade ago
    Favorite Answer

    A delimited text file is one in which each line of text is a record, and the fields are separated by a known character.

    The character used to delimit the data varies according to the type of data. Common delimiters include the tab character (\t in Perl) or various punctuation characters. The delimiter should always be one which does not appear in the data.

    Delimited text files are easily produced by most desktop spreadsheet and database applications (eg Microsoft Excel, Microsoft Access). You can usually choose "File" then "Save As" or "Export", then select the type of file you would like to save as.

    Imagine a file which contains peoples' given names, surnames, and ages, delimited by the pipe (|) symbol:

    Fred|Flintstone|40

    Wilma|Flintstone|36

    Barney|Rubble|38

    Betty|Rubble|34

    Homer|Simpson|45

    Marge|Simpson|39

    Bart|Simpson|11

    Lisa|Simpson|9

  • 3 years ago

    Pipe Delimited

  • 1 decade ago

    a series of data entries that are seperated by the pipe symbol

    e.g.

    FirstName|LastName

    Mark|Foster

    Roger|Sanchez

    Michael|Foster

    would be an example. From this set of text the first line shows the name fields - FirstName and LastName. The subsequent lines shows the different data sets. Mark is the FirstName and Foster is the LastName, Roger is the FirstName and Sanchez is the LastName.

    Hope that makes sense

  • 4 years ago

    For the best answers, search on this site https://shorturl.im/hH4mH

    Here's something for you. It's not working code, but should help to point you in the right direction... // Get a file into an array, skipping empty lines $lines = file('/tmp/inputfile.txt', FILE_SKIP_EMPTY_LINES); // Loop through the $lines array to get each line foreach ($lines as $line_num => $line) { //explode the $line $cur_line = explode('|',$line); // compose the sql string, just to show you how it's done. $sql = 'INSERT INTO your_table '; $sql .= '(field1, ... , field6)'; // and pick up the only the first 6 fields. $sql .= "VALUES ('$cur_line[0]', ... ,'$cur_line[5]')"; //execute your sql mysql_query($sql); } Hope that helps...

  • How do you think about the answers? You can sign in to vote the answer.
  • 5 years ago

    why are you calling the vertical bar a "pipe"? ... nobody calls it that

Still have questions? Get your answers by asking now.