linux-admin.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* split a file or return shell variable to a program
@ 2004-04-22 18:33 vick Julius
  2004-04-22 19:04 ` Glynn Clements
  2004-04-22 21:16 ` rich+ml
  0 siblings, 2 replies; 6+ messages in thread
From: vick Julius @ 2004-04-22 18:33 UTC (permalink / raw)
  To: linux-admin


Hello everbody
I have a text file I want to split. The file contains some sentences. 
between sentences I have empty 1 line. I want to split this file and put 
each sentence in a separate file with names 1, 2,3 ...
do you have any idea to split it such as with awk or split?

Here is my strategy:

I wrote a C program in which I call bash shell script to increment a 
variable...

In the shell I defined the variable k such as:
$export k=1
in my bash script file,myFile,  for testing, I put
echo $k
let k+=1
(or this expression k=`expr $k + 1`)
echo $k

when I run this script file, it gives me
1
2

the problem is when I called form a C or C++ program, such
system("echo $k");
//this gives 1
system("./myFile");
// this display
// 1
//2
system("echo $k");
//here the problem, it display 1 not 2

I want to have the incremented value for k, i.e 2 not the original one.

Do you have any hint?

Vick

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-07-14 23:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-22 18:33 split a file or return shell variable to a program vick Julius
2004-04-22 19:04 ` Glynn Clements
2004-04-23  8:10   ` urgrue
2004-04-22 21:16 ` rich+ml
2004-07-14 21:55   ` running fsck in runlevel 3 and single user mode serial access problems A. R. Vener
2004-07-14 23:19     ` Lothar Braun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).