~1
ACCOUNT1
34765367
001
5637463648374
1
32476743
85468456875
003
~1
~2
ACCOUNT2
23587458745647
1
002343
2347938457
~2
....SO ON
I want to print it into another file in below format :
ACCOUNT134765367001563746364837413247674385468456875003
ACCOUNT22358745874564710023432347938457
I have written something like this below which works till ~9 perfectly, but for ~10 it is adding the 10 record also to ~1 record, at the end of ~1 record. I think I need to update my Regex pattern...pls help
max_input=2
path1=/home
line_number_m=1
while [ ${line_number_m} -le ${max_input} ]
do
o_p=""
sed -n "/^${line_number_m},/^~{line_number_m}/p" ${path1}/temp_op.txt | sed
"s/^${line_number_m}//" > ${path1}/tmp.txt
while read val
do
if [ -z ${val} ]
then
continue
else
o_p=`echo ${o_p}``echo ${val}`
fi
done< ${path1}/tmp.txt
echo ${o_p} >>${path1}/tmp_output.txt
line_number_m=`expr ${line_number_m} + 1`
done
rm ${path1}/tmp.txt
tail -n +2 ${path1}/tmp_output.txt > ${path1}/output.txt
rm ${path1}/tmp_output.txt
exit 0
The record inside ~1 and ~1 can be any random numbers or character or even spaces like below : ~1 001 13324324343 COMMON 6 487364754557465 --2space 5874654657 ---3 Space 48567846574 4568746574657 --5spaces--- ~1
I want my output like below : 00113324324343COMMON6487364754557465--5874654657---485678465744568746574657-----