Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
problem using cat to read data
Name: elpico Date: January 31, 2005 at 08:43:19 Pacific OS: solaris CPU/Ram: 256
Comment:
Hi all,
I'm having problems reading in data from a data file when I use the cat command within a ksh script. I want to read in the whole line at a time, and not lose the spaces within it.
#test.dat
3729 UK 3462 UK 2483 Spain 3567 UK 6747 US 3299 France 4666 UK 4899 UK 7777 Germany 4900 UK
#script.ksh
for val in `cat test.dat`; do echo $val done
Unfortunately that reads in each value at a time - I need to read in the whole line at a time and not lose any spaces - Any idea what I can use?
Summary: If you already know awk, then the most of the issue is solved. Just use awk to read in a line at a time and to assign the designate values to their respective variables. Hope this helps, good luck. ...
Summary: I assume that the java tag you want to insert is in a file called javatag.txt. Use sed to read javatag.txt after the string ending in <product>: #!/bin/ksh sed '/<product>$/r javatag.txt' dataf...
Summary: I have found out that some code I am working on could be made simpler and neater by writing files to new streams created by me, and then later reading from those new streams line by line in a loop. Th...