06-24-2010
thanks dr. the below query worked out. But still i am facing a problem in line 3rd, 6th etc(Prob o/p). How can we move |0 to the last col and get output like below:
31|474012|13/04/2010|0001236|2.09 or
31|474012|13/04/2010|(9 spaces)|2.09
prob:
31|474012|13/04/2010|0001236|2.09
31|474013|13/04/2010|0001237|1.51
31|651003|18/11/2008|0
31|652005|14/01/2009|0001248|389
31|663018|18/01/2010|0001250|295
31|651003|18/11/2008|0
10 More Discussions You Might Find Interesting
1. Programming
#include <iostream.h>
class test
{
private:
int i;
public:
inline test(int m)
{
i = m;
}
inline int get_i()
{
return i;
}
};
int main()
{
test * a = new test(2); (3 Replies)
Discussion started by: xbjxbj
3 Replies
2. Shell Programming and Scripting
Hello folks,
I am facing a problem with the following korn shell script snippet:
ftp -n -i -v <<EOF
print -p open $CURR_HOST
print -p user $USER $PASSWD
print -p binary
print -p cd /mydir/subdir/datadir
print -p get $FILENAME
print -p bye
EOF
exit
It gives me the following... (3 Replies)
Discussion started by: Rajat
3 Replies
3. Programming
Could anyone tell me whats wrong whit this piping? the commands that they execute are correct. the command I am trying is ls|wc. Both processes go to the right if statement.
for(i=0;i<argc;i++){
if(i==0&&argc>1){//first command
if(pipe(pipa1)==-1)
... (2 Replies)
Discussion started by: isato
2 Replies
4. Shell Programming and Scripting
I have a string of commands I am piping some data through and I want to allow command line switches to select which commands are used. I want to do something like this: OPTION="| command3"
command1 -a -b c.txt | command2 -d -e $OPTION >result.txt
I want to do it that way because OPTION may be... (1 Reply)
Discussion started by: KenJackson
1 Replies
5. UNIX for Dummies Questions & Answers
I get the following error
./get_NE05: line 42:
while
do
echo ${STRING_NAME}
J=1
if ; then
EXT=0$I
else
EXT=$I
fi
while
do
echo $I-$J
#calculating last occurrence
OCCURRENCE=`grep -io "${STRING_NAME}"... (3 Replies)
Discussion started by: f_o_555
3 Replies
6. Shell Programming and Scripting
Hi,guys:
I want to use c to implement a pipe. For example:
ps auxwww | grep fred | more
I forked three child processes. Each is responsible for each command, and pipe to next one.
for(i=0;i<2;i++)
pipe(fd)
if(child==1) // child 1
{
close(1)
dup2(fd,1)
close(fd)
}... (3 Replies)
Discussion started by: tomlee
3 Replies
7. UNIX for Dummies Questions & Answers
Hello everyone,
on the man page of "magic(5)"
There is explanation
"&, to specify that the value from the file must have set all of the bits that are set in the specified value" .
My question is that what is the difference between '&' and equal operator '=' ? I tested it with file... (6 Replies)
Discussion started by: segmentation
6 Replies
8. Programming
Hi,
I have this following code which gives me error when compiling. The problem is happening at the point where I create a const_iterator inside the overloaded insertion operator (i.e) operator << () function. The template argument version of set is not correct I guess. Could anyone please pitch... (3 Replies)
Discussion started by: royalibrahim
3 Replies
9. Shell Programming and Scripting
Hi,
I've tried searching through the forum but I've drawn a blank so i'm going to post here. I'm developing a number of checks on a CSV file, trying to find if any are greater than a max limit. I'm testing it by running it from a command line.
The file I'm testing has 8 records. When I... (3 Replies)
Discussion started by: Tmart
3 Replies
10. Shell Programming and Scripting
Hello all, I have two files which are cmd and disk.
`$cat cmd
lsdev | grep -iw`
`$cat disk
hdisk2`
Now I want to use the contents of both the files in a way such that `lsdev | grep -iw` command works for hdisk2 when I write the following script:
`!#/bin/sh
cmd1="$( sed -n... (4 Replies)
Discussion started by: ravi.trivedi
4 Replies
PIPE(2) System Calls Manual PIPE(2)
NAME
pipe - create an interprocess channel
SYNOPSIS
#include <u.h>
#include <libc.h>
int pipe(int fd[2])
DESCRIPTION
Pipe creates a buffered channel for interprocess I/O communication. Two file descriptors are returned in fd. Data written to fd[1] is
available for reading from fd[0] and data written to fd[0] is available for reading from fd[1].
After the pipe has been established, cooperating processes created by subsequent fork(2) calls may pass data through the pipe with read and
write calls. The bytes placed on a pipe by one write are contiguous even if many processes are writing. Write boundaries are preserved:
each read terminates when the read buffer is full or after reading the last byte of a write, whichever comes first.
The number of bytes available to a read(2) is reported in the Length field returned by fstat or dirfstat on a pipe (see stat(2)).
When all the data has been read from a pipe and the writer has closed the pipe or exited,
read(2) will return 0 bytes. Writes to a pipe with no reader will generate a note sys: write on closed pipe.
SOURCE
/sys/src/libc/9syscall
SEE ALSO
intro(2), read(2), pipe(3)
DIAGNOSTICS
Sets errstr.
BUGS
If a read or a write of a pipe is interrupted, some unknown number of bytes may have been transferred.
When a read from a pipe returns 0 bytes, it usually means end of file but is indistinguishable from reading the result of an explicit write
of zero bytes.
PIPE(2)