Sponsored Content
Top Forums Programming c program to extract text between two delimiters from some text file Post 302160284 by kukretiabhi13 on Monday 21st of January 2008 10:47:23 AM
Old 01-21-2008
Lightbulb NEED a C program to extract text between two delimiters from some text file

needa c program to extract text between two delimiters from some text file.
and then storing them in to diffrent variables ?

text file like 0:
abc.txt
=========

aaaaaa|11111111|sssssssssss|333333|ddddddddd|34343454564|asass
aaaaaa|11111111|sssssssssss|333333|ddddddddd|34343454564|asass
aaaaaa|11111111|sssssssssss|333333|ddddddddd|34343454564|asass
aaaaaa|11111111|sssssssssss|333333|ddddddddd|34343454564|asass
aaaaaa|11111111|sssssssssss|333333|ddddddddd|34343454564|asass
aaaaaa|11111111|sssssssssss|333333|ddddddddd|34343454564|asass
aaaaaa|11111111|sssssssssss|333333|ddddddddd|34343454564|asass

==============

Last edited by kukretiabhi13; 01-21-2008 at 01:00 PM.. Reason: clearity
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

extract text b/w two delimiters

I have an input file which looks like " @$SCRIPT/atp_asrmt_adj.sql $SCRIPT/dba2000.scr -s / @$SCRIPT/cim1005w.pls $SCRIPT/dba2000.scr -s / @$SCRIPT/cim1006w.pls start $SCRIPT/cim1020d.sql;^M spool $DATA/cim1021m.sql @$DATA/cim1021m.sql ! rm $DATA/cim1021m.sql spool $DATA/cim1021m.sql... (6 Replies)
Discussion started by: dowsed4u8
6 Replies

2. Shell Programming and Scripting

how to extract columns from a text file

Hi, In ksh, I have a file with similar rows as follows: Department = 1234 G/L Asset Acct No = 12.0000. 2/29/2008 Department = 1234 G/L Asset Acct No = 13.0000. 3/29/2008. I want to create a new text file that contains only the numbers and date: 1234 12.0000. 2/29/2008 1234 13.0000. ... (16 Replies)
Discussion started by: ihot
16 Replies

3. AIX

Print text between two delimiters

Hi, Can somebody help me with the below situation, Input File, ======== 2007_08_07_IA-0100-014_(MONTHLY).PDF 2007_08_07_IA-0100-031_(QUARTERLY)(RERUN).PDF 2008-02-28_KR-1022-003_(MONTH)(RERUN)(REC1).CSV Required output, ============ MONTHLY QUARTERLY MONTH ... (15 Replies)
Discussion started by: sravicha
15 Replies

4. Shell Programming and Scripting

Fetch the rows with match string on a fixed lenth text file - NO delimiters

Hi I am trying to fetch the rows with match string "0000001234" Input file looks like below: 09 0 XXX 0000001234 Z 1 09 0 XXX 0000001234 Z 1 09 0 XXX 0000001234 Z 1 09 0 XXX 0000001234 Z 1 09 0 XXX 0000001234 Z 1... (6 Replies)
Discussion started by: nareshk
6 Replies

5. Shell Programming and Scripting

extract particular lines from text file

I have two files file A which have a number in every row and file B which contains few hundred thousand rows with about 300 characters in each row (csv) What I need is to extract whole rows from B file (only these which numbers are indicated in A file) I also need to use cygwin. Any... (7 Replies)
Discussion started by: gunio
7 Replies

6. Shell Programming and Scripting

Order text by delimiters

I try order the content from file by delimiters. This is the text: interface Loopback0 description !!!RID RR_SLT ip address 172.31.128.19 255.255.255.255 interface GigabitEthernet0 description !!!P_SLT GI0/0/9 ip address 172.31.130.246 255.255.255.252 and the result that I need... (11 Replies)
Discussion started by: bobbasystem
11 Replies

7. Shell Programming and Scripting

extract text from a file

I have been reading several posts regarding how to extract text from a file, but none of those have helped me for what I need. This is my problem: I need to extract the text after my pattern So my line is: 485.74 6589.5 Log likelihood: 1485.79 My pattern is 'Log likelihood:' and I need... (2 Replies)
Discussion started by: loperam
2 Replies

8. Shell Programming and Scripting

Print text between delimiters IF it contains a certain term...

So I'm racking my brain on appropriate ways to solve a problem that once fixed, will solve every problem in my life. Its very easy (for you guys and gals) I'm sure, but I can't seem to wrap my mind around the right approach. I really want to use bash to do this, but I can't grasp how I'm going to... (14 Replies)
Discussion started by: eh3civic
14 Replies

9. Shell Programming and Scripting

extract a word from text file name

Hi i want to extract the word present before .txt in the text file. For example, Sample_ab_a.txt ----------> i need 'a' Sample_abc_b.txt -----------> i need 'b' Can anyone help me in getting the word extracted (5 Replies)
Discussion started by: Sindhuap
5 Replies

10. Shell Programming and Scripting

Match text to lines in a file, iterate backwards until text or text substring matches, print to file

hi all, trying this using shell/bash with sed/awk/grep I have two files, one containing one column, the other containing multiple columns (comma delimited). file1.txt abc12345 def12345 ghi54321 ... file2.txt abc1,text1,texta abc,text2,textb def123,text3,textc gh,text4,textd... (6 Replies)
Discussion started by: shogun1970
6 Replies
strextract(1int)														  strextract(1int)

Name
       strextract - batch string extraction

Syntax
       strextract [ -p patternfile ] [ -i ignorefile ] [ -d ] [ source-program...  ]

Description
       The  command extracts text strings from source programs.  This command also writes the string it extracts to a message text file.  The mes-
       sage text file contains the text for each message extracted from your input source program. The command names the file by appending .msg to
       the name of the input source program.

       In  the	source-program argument, you name one or more source programs from which you want messages extracted. The command does not extract
       messages from source programs included using the directive. Therefore, you might want a source program  and  all  the  source  programs	it
       includes on a single command line.

       You  can  create a patterns file (as specified by patternfile ) to control how the command extracts text. The patterns file is divided into
       several sections, each of which is identified by a keyword. The keyword must start at the beginning of a new line, and its first  character
       must  be  a dollar sign ($).  Following the identifier, you specify a number of patterns. Each pattern begins on a new line and follows the
       regular expression syntax you use in the routine. For more information on the patterns file, see the(5int) reference page.

       In addition to the patterns file, you can create a file that indicates strings that ignores.  Each line in this ignore file contains a sin-
       gle string to be ignored that follows the syntax of the routine.

       When you invoke the command, it reads the patterns file and the file that contains strings it ignores.  You can specify a patterns file and
       an ignore file on the command line.  Otherwise, the command matches all strings and uses the default patterns file.

       If finds strings which match the directive in the pattern file, it reports the strings to standard error (stderr.) but does not	write  the
       string to the message file.

       After running you can edit the message text file to remove text strings which do not need translating before running

       It is  recommended that you use command	as a visual front end to the command rather than running directly.

Options
       -i   Ignore  text  strings specified in ignorefile.  By default, the command searches for ignorefile in the current working directory, your
	    home directory, and

	    If you omit the option, recognizes all strings specified in the patterns file.

       -p   Use patternfile to match strings in the input source program. By default, the command searches for the pattern  file  in  the  current
	    working directory, your home directory, and finally

	    If you omit the option, the command uses a default patterns file that is stored in

       -d   Disables warnings of duplicate strings. If you omit the option, prints warnings of duplicate strings in your source program.

Restrictions
       Given the default pattern file, you cannot cause to ignore strings in comments that are longer than one line.

       You can specify only one rewrite string for all classes of pattern matches.

       The command does not extract strings from files include with directive. You must run the commands on these files separately.
       % strextract -p c_patterns prog.c prog2.c
       % vi prog.msg
       % strmerge -p c_patterns prog.c prog2.c
       % gencat prog.cat prog.msf prog2.msf
       % vi nl_prog.c
       % vi nl_prog2.c
       % cc nl_prog.c nl_prog2.c -li

       In this example, the command uses the file to determine which strings to match. The input source programs are named and

       If  you	need  to  remove  any  of the messages or extract one of the created strings, edit the resulting message file, Under no conditions
       should you add to this file. Doing so could result in unpredictable behavior.

       You issue the command to replace the extracted strings with calls to the message catalog.  In response to this command, creates the  source
       message catalogs, and and the output source programs, and

       You must edit and to include the appropriate and function calls.

       The command creates a message catalog and the command creates an executable program.

See Also
       intro(3int), gencat(1int), extract(1int), strmerge(1int), regex(3), catopen(3int), patterns(5int)
       Guide to Developing International Software

																  strextract(1int)
All times are GMT -4. The time now is 06:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy