I would like to read a file line by line and then store the whole line word by word in array so that I can do specific manipulation on each word.
HTML Code:
$ cat test.txt
hello how are you
i am good
I would like to have an array created dynamically so that first time , the array will have 4 values (hello,how,are,you) and then change hello to hi and store it in the array again .Next it will have 3 values (i,am,good) and prints them.The file can have any number of lines (<1000) and each line can have upto (300 words)
Last edited by ashwin3086; 08-06-2013 at 06:03 AM..
Hi all,
I'm quite new to unix and hope that someone can help me on this.
I'm using csh.
Below is what i intend to do.
1. I stored some data in a file.
2. I intend to read the file line by line and store each line of data into a variable, so that i can used it later.
Anyone have any... (4 Replies)
i have this line
my,name,is,john
stored in a file d.sh and i wish to print the line as string..but im getting word by word...have tried this.........
for in $(cat $d.sh);
do
echo $i
done
but this is giving me
my
name
is
john (6 Replies)
Assume I have a text file as below:
me
con pi
ind ken
pras ur
me
con rome
ind kent
pras urs
pintu
con mys
ind pan
pras ki
con kit
ind sys
My requirement,
I need to search for "con rome" and if exists, then print 4th word from rome, i.e in above example, since "con rome"... (4 Replies)
I am using the while-loop to read a file.
The file has lines with null-terminated strings (words, actually.)
What I have by that reading - just a first word up to '\0'!
I need to have whole string up to 'new line' - (LF, 10#10, 16#A)
What I am doing wrong?
#make file 'grb' with... (6 Replies)
Hi people;
i want to read the last word of the 14th line of my file1.txt. Here is the EXACT 14th line of the file.
250 SectorPortnum=3,AuxPortInUngo=2,PortDeviceGroup=1,PortDeviceSet=1,PorDevice=1 20 >>> Set.
i have to get the word Set. how can i call it and also how... (3 Replies)
Hello, I am quite new in shell scripting and I would like to write a little scritp to run a program on some parameters files.
all my parameters files are in the same directory, so pick them up with
ls *.para >>dirafter that I have a dir file like that:
param1.para
param2.para
etc...
I... (2 Replies)
Hi, I need a script to read last word of the line and out put in some temp file.
i
it can contain any word like:
My name is Harry.
or
My zip code is 24490
or it can be
My secret code is 024H
I just need last word of the line (Harry, or 2440 or 024H)
Thanks for the posts below.... (10 Replies)
Hi,
I wish to write a piece of code to read lines of the flat file and cut each lines of record to a variable, then use this variable to pass as an parameter of a Sybase stored procedures, if there are 5 lines of record from the text file, then this stored procedures will be called 5 times.... (8 Replies)
Hi All,
Hope you guys had a wonderful weekend
I have a scenario where in which I have to read a file line by line
and check for few words before redirecting to a file
I have searched the forum but,either those answers dint work (perhaps because of my wrong under standing of how IFS... (6 Replies)
I have a file: file.txt, which contains the following data in it.
This is a file, my name is Karl, what is this process, karl is karl junior, file is a test file, file's name is file.txt
My name is not Karl, my name is Karl Joey
What is your name?
Do you know your name and... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies
LEARN ABOUT DEBIAN
subyte
STORE(9) BSD Kernel Developer's Manual STORE(9)NAME
store, subyte, suswintr, suword -- store data to user-space
SYNOPSIS
#include <sys/types.h>
#include <sys/time.h>
#include <sys/systm.h>
int
subyte(void *base, int byte);
int
suword(void *base, long word);
int
suword16(void *base, int word);
int
suword32(void *base, int32_t word);
int
suword64(void *base, int64_t word);
#include <sys/resourcevar.h>
int
suswintr(void *base, int word);
DESCRIPTION
The store functions are designed to copy small amounts of data to user-space.
The store routines provide the following functionality:
subyte() Stores a byte of data to the user-space address base.
suword() Stores a word of data to the user-space address base.
suword16() Stores 16 bits of of data to the user-space address base.
suword32() Stores 32 bits of of data to the user-space address base.
suword64() Stores 64 bits of of data to the user-space address base.
suswintr() Stores a short word of data to the user-space address base. This function is safe to call during an interrupt context.
RETURN VALUES
The store functions return 0 on success or -1 on failure.
SEE ALSO copy(9), fetch(9)BSD October 5, 2009 BSD