12-08-2008
Reading frm text file
hi,
Actually i have a text file which contain data in the following format:
----------------------------------
black pepper
john barber
steven johnson
------------------------------------
and the list goes on.
I'm writing a c program that reads the text file and output the following on the console:
-------------------------------------
othername: black
surname: pepper
othername: john
surname: barber:
othername: steven
surname: johnson
--------------------------------------
and so one.
could anyone please post the source code for me...
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a text file with 50 munbers.
I wanna read these numbers and append "@yahoo.com" and send emails to them using shell scripting..........
How do i read the inetegres from the text file. (1 Reply)
Discussion started by: jaan
1 Replies
2. Shell Programming and Scripting
Guys,
I am trying to read text from a file, into arrays.
The format of the file is:
@DATABASE
femotest
@PACKAGE_SPECS
/usr/home/oracle92/sosa/scripts/test.pks
/usr/home/oracle92/sosa/scripts/rep.pks
@PACKAGE_BODIES
... (12 Replies)
Discussion started by: LiquidChild
12 Replies
3. Shell Programming and Scripting
Hi
Im MZ.... please help me with my requirements.....
Requirement: I have a text file named information.txt which contains information about Oracle Instances, I want to fetch data's from that text file and want to display an output using shell script.
Explanation : i.e. when I execute that... (0 Replies)
Discussion started by: user__user3110
0 Replies
4. UNIX for Dummies Questions & Answers
How can i have a while loop as follows
while read inputline
do
<task>
done < name_list
and also store the values (delimited) on each line to temp variables so as to print them on screen as follows
while read inputline
do
set name | cut -d "," -f1 name_list # #i know this is not... (1 Reply)
Discussion started by: bilal05
1 Replies
5. Shell Programming and Scripting
Hello,
I am having a tough time reading data from an input text file.
The input file has lines of data which is comma seperated. Each line represents a record/row, but unfortunately the data in the individual column/fields have spaces and `cat filename`is not returning entire line ( to read... (4 Replies)
Discussion started by: yajaykumar
4 Replies
6. UNIX for Dummies Questions & Answers
say i have a text file called "input.txt"
1 5
2 10
3 15
4 20
and say I wanted to read the row 3 from column 2 how would i go about it.
I guess I would use "awk" but I'm not sure how. (2 Replies)
Discussion started by: THM
2 Replies
7. Programming
hello all ,
im trying to read a text file and display its contents. While i got the code running and the output was displayed perfectly for sometime , i started getting Abort(core dump) error . Am i missing something here ? im using HP-UX.
#include <iostream.h>
#include <fstream.h>
#include... (1 Reply)
Discussion started by: vishy_85
1 Replies
8. Shell Programming and Scripting
I am having a text file
best = 100
genre = 75
group = 53
.
.
and so on
I need to read those values (100,75,53,...) from my shell script. I have to do the same function for all the variables. So in my script i used for loop to do the same.
for {
a=best
b=100
}
Video tutorial on... (3 Replies)
Discussion started by: kishorekumar87
3 Replies
9. UNIX for Dummies Questions & Answers
hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file
<sequence>
<Filename>aldorzum.doc</Filename>
<DivisionCode>US</DivisionCode>
<ContentType>Template</ContentType>
<ProductCode>VIMZIM</ProductCode>
</sequence>... (4 Replies)
Discussion started by: sravanreddy
4 Replies
10. Programming
Hello Team,
I have 2 files.one contains english text and another contains Japanese. so i have to read english text and replace the text with Japanesh text in third file.
Basically, I need a help to write japanese language in text/xml file.I heard wstring does this.Not sure how do i write... (2 Replies)
Discussion started by: SA_Palani
2 Replies
LEARN ABOUT SUSE
fvwm-themes-com
FVWM-THEMES-COM(1) Fvwm Utility FVWM-THEMES-COM(1)
NAME
fvwm-themes-com - fvwm-themes communication center
SYNOPSIS
fvwm-themes-com [ --help] [ --version] [ --name name ] [ --message message ] [ --lock-and-get ] [ --get-buffer ] [ --clear-buffer ] [
--buffer-name name ] [ --line lineNbr]
DESCRIPTION
This script is not a user script. It is used by Fvwm-Themes for communication between some FvwmScript scripts and some other programs.
Basically, you want to start a programs in the background which support the fvwm-themes-com communication protocol (e.g., fvwm-themes-menu-
app and fvwm-themes-config with the com-mode option can be used as generic examples), then you can use fvwm-themes-com to ask questions or
to give instructions to the background program. The answer are displayed by fvwm-themes-com in the standard out put and can be used by a
FvwmScript script via the GetoutPut instruction. The advantage of using this method is that the background program have to do its main job
only once (e.g., parsing a lot of informations and storing them in some variables) and a script can have very fast answer from the back-
ground program via fvwm-themes-com.
OPTIONS
--help - show the help and exit
--version - show the version and exit
--name name - the name of the communication (e.g., if you start fvwm-themes-menuapp with --com-name pid option you must use menuapp-pid as
name to communicate with it). The pipe used for communication are $FVWM_DATADIR/{.tmp-com-in-name,tmp-com-out-name,tmp-com-lock-name}. The
"buffer" file is $FVWM_USERDIR/.tmp-com-buffer-name
--message - A one line message to be sent to the back program.
--lock-and-get - Wait (a certain "time out") for an answer of the message. Then, the answer is displayed on STDOUT.
--line n - n must be an integer n > 0. In the case of a lock and get message, fvwm-themes-com will out put only the nth line of the answer
of the back program on STDOUT and will copy the complete answer in a "buffer" file. If you use the get-buffer option the nth line of the
buffer is out put on STDOUT.
--get-buffer - Out put the buffer file on STDOUT.
--buffer-name othername - Use an alternative name for the buffer file: $FVWM_USERDIR/.tmp-com-buffer-othername. This is usefull if two pro-
grams use the same background program and both use the buffer.
--clear-buffer - remove the buffer file.
USAGE
Here an example:
In the Script FvwmScript-Menus you first start the background program, here fvwm-themes-menuapp, and you set some variables for an easy use
of fvwm-themes-com:
# found the FvwmScript pid
Set $CMD = {perl -e '$t=getppid; print $t . "
"'}
Set $PID = (GetOutput $CMD 1 -1)
# Run fvwm-themes-menuapp until the end of the script
Do {Exec fvwm-themes-menuapp --com-mode --com-name=menuapp-}$PID{ &}
# to send fvwm-themes-com command
Set $SendMsgAndGet = {fvwm-themes-com --name menuapp-}$PID{ --lock-and-get --message=}
Set $SendMsg = {fvwm-themes-com --name menuapp-}$PID{ --message=}
Set $GetLine = {fvwm-themes-com --name menuapp-}$PID{ --get-buffer --line=}
Then in the Script you can ask fvwm-themes-menuapp for some informations:
# Get the menu list
Set $CMD = $SendMsgAndGet{"menu-items }$MENU{"}
Set $ItemsList = (GetOutput $CMD 1 -1)
ChangeTitle 11 $ItemsList
You can also just send an instruction to fvwm-themes-menuapp:
Set $CMD = $SendMsg{"exit"}
Do {Exec }$CMD
Of course your back program have to support the fvwm-themes-com protocol. See fvwm-themes-menuapp and fvwm-themes-config for examples (com-
mode option). See also FvwmScript-Menus and FvwmScript-ThemesCenter.
AUTHORS
Olivier Chapuis <olivier.chapuis@free.fr>, 5 May 2000.
COPYING
The script is distributed by the same terms as fvwm itself. See GNU General Public License for details.
BUGS
Report bugs to fvwm-themes-devel@lists.sourceforge.net
3rd Berkeley Distribution perl v5.6.0 FVWM-THEMES-COM(1)