Hi Baskar, hope this awk will help you..

cat a1a
21000    Probability, Random Variables, and
Stochastic Processes / Athanasios
Papoulis. : McGraw-Hill, Inc., 1995
21001                     "
21002    Microwave Devices and Circuits
/ Samuel Y.Liao. : Prentice-Hall of
India Private Limited, 1990
21003                     "
21004    Physics of Semiconductor Devices
/ Sze S.M. : John Wiley & Sons, 1981
21005                     "
21006    Digital signal processing: a system
design approach / David U. Defatta.
: John Wiley & Sons (SEA) Pte Ltd
, 1988


awk '{if($1 ~ /^[0-9]../){print "\n"; printf $0}else{printf $0}}' a1a

or

awk '{if($1 ~ /^[0-9][0-9][0-9][0-9][0-9]/){print "\n"; printf
$0}else{printf $0}}' a1a



On Tue, May 19, 2015 at 6:04 PM, Baskar Selvaraj <bas...@linuxpert.in>
wrote:

> Hi all,
>
> I have a text file with more than 10K+ lines in the following format.
> I want to merge the text data in a single line as shown in the bottom.
> Any sed/awk solution would be helpful.
>
> Input file
> ----------
>
> 21000    Probability, Random Variables, and
> Stochastic Processes / Athanasios
> Papoulis. : McGraw-Hill, Inc., 1995
> 21001                     "
> 21002    Microwave Devices and Circuits
> / Samuel Y.Liao. : Prentice-Hall of
> India Private Limited, 1990
> 21003                     "
> 21004    Physics of Semiconductor Devices
> / Sze S.M. : John Wiley & Sons, 1981
> 21005                     "
> 21006    Digital signal processing: a system
> design approach / David U. Defatta.
> : John Wiley & Sons (SEA) Pte Ltd
> , 1988
>
> Required output:
> ----------------
>
> 21000    Probability, Random Variables, and Stochastic Processes /
> Athanasios Papoulis. : McGraw-Hill, Inc., 1995
> 21001                     "
> 21002    Microwave Devices and Circuits / Samuel Y.Liao. :
> Prentice-Hall of India Private Limited, 1990
> 21003                     "
> 21004    Physics of Semiconductor Devices / Sze S.M. : John Wiley & Sons,
> 1981
> 21005                     "
> 21006    Digital signal processing: a system design approach / David
> U. Defatta. : John Wiley & Sons (SEA) Pte Ltd, 1988
>
> Thanks in advance
>
> S. Baskar
> _______________________________________________
> ILUGC Mailing List:
> http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
> ILUGC Mailing List Guidelines:
> http://ilugc.in/mailinglist-guidelines
>
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
ILUGC Mailing List Guidelines:
http://ilugc.in/mailinglist-guidelines

Reply via email to