Cutting a part of line till delimiter

view full story

http://www.unix.com – here are the few scenarios... Code: isoSizeKB text NOT NULL,  reserved1 varchar(255),       KEY `deviceId` (`deviceId`) `d5` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `dHead` enum('HistoryInfo','Diversion') COLLATE utf8_unicode_ci, `ePR` int(11) DEFAULT '0',   PRIMARY KEY (`id`) what i want to achieve is if the line has ',' at the end it deletes it... and also spaces(or tabs) before or after the line.... i tried echo "reserved1 varchar(255)," | cut -d ',' -f1 | sed 's/^[ ]*//g;s/[ ]*$//g' but this willl not work for all conditions say if th (HowTos)