The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to extract columns from a text file ihot Shell Programming and Scripting 16 05-05-2008 11:33 PM
extract text b/w two delimiters dowsed4u8 UNIX for Advanced & Expert Users 6 01-18-2008 05:48 PM
Extract text in 2 columns of output file. Danish Shakil Shell Programming and Scripting 2 10-19-2007 10:03 AM
How to extract text from xml file chrisf Shell Programming and Scripting 3 09-01-2007 02:25 PM
How to extract data from a text file negixx Shell Programming and Scripting 1 07-19-2005 09:30 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-21-2008
kukretiabhi13 kukretiabhi13 is offline
Registered User
  
 

Join Date: Jan 2008
Location: India
Posts: 13
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
  #2 (permalink)  
Old 01-21-2008
shamrock shamrock is offline Forum Advisor  
Registered User
  
 

Join Date: Oct 2007
Location: USA
Posts: 750
Question

Quote:
Originally Posted by kukretiabhi13 View Post
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

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

I have a question as I am unable to follow your thread. Do you want each of the values separated by the pipe symbol "|" to be stored into a separate variable and what do you want to do with them afterwards?
  #3 (permalink)  
Old 01-21-2008
ramen_noodle ramen_noodle is offline Forum Advisor  
Registered User
  
 

Join Date: Dec 2007
Location: Virginia, USA.
Posts: 251
Attached is a basic idea if I'm getting you right. Untested and using GNU format string extensions. YMMV.
Attached Files
File Type: txt readdelims.txt (1.1 KB, 272 views)
  #4 (permalink)  
Old 01-22-2008
kukretiabhi13 kukretiabhi13 is offline
Registered User
  
 

Join Date: Jan 2008
Location: India
Posts: 13
This is what i actually need :

eg:

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

my c program should read the first line and
then store
aaaaaaa in some variable x
11111111111 in some variable y and so on .......

program will identify the strings that are written b/w two delimiters
i.e '|'
store in variable x till i reach the next delimiter than to the next delimiter is stored in variable y.
  #5 (permalink)  
Old 01-22-2008
quintet quintet is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 94
u can use 'strtok' function
  #6 (permalink)  
Old 01-22-2008
kukretiabhi13 kukretiabhi13 is offline
Registered User
  
 

Join Date: Jan 2008
Location: India
Posts: 13
Thank u all .....
its done .......
  #7 (permalink)  
Old 12-03-2008
abirami abirami is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 1
Need The Pgm

Hi can u post the program ...so that i can get an idea of ur implementation

thanks
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:36 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0