Dear sir
I am having a file x.lst having
abcd
andother file y.lst having
efgh
I should get report file having the result in a single row as
abcdefgh
pls help
Dear sir
I am having a file x.lst having
abcd
andother file y.lst having
efgh
I should get report file having the result in a single row as
abcdefgh
pls help
look into 'man paste'
Worked on FreeBSD :
cat file1 file2 | paste -s -d \0 -
not on ubuntu linux:
miro@miro-ntb:tmp$ cat fact.sh
#!/bin/bash
function fac {
N=$1
fact=1
while [ $N -gt 1 ] ; do
fact="${fact}*${N}"
((N--))
done
echo $fact | bc
}
fac $1
miro@miro-ntb:tmp$ cat fact.sh fact.sh | paste -s -d \0 -
#!/bin/bash00function fac {0 N=$10 fact=10 while [ $N -gt 1 ] ; do 0 fact="${fact}*${N}"0 ((N--))0 done0echo $fact | bc0}00fac $10#!/bin/bash00function fac {0 N=$10 fact=10 while [ $N -gt 1 ] ; do 0 fact="${fact}*${N}"0 ((N--))0 done0echo $fact | bc0}00fac $1
This, however will do the trick:
miro@miro-ntb:tmp$ paste -d"\0" fact.sh fact.sh
#!/bin/bash#!/bin/bash
function fac {function fac {
N=$1 N=$1
fact=1 fact=1
while [ $N -gt 1 ] ; do while [ $N -gt 1 ] ; do
fact="${fact}*${N}" fact="${fact}*${N}"
((N--)) ((N--))
done done
echo $fact | bcecho $fact | bc
}}
fac $1fac $1