G
gors
We have big file has lines as:
ITEM1 PRODUCT PRICE 3.47
ITEM2 PRODUCT_DETAILS PRICE 4.47
ITEM3 PRODUCT_DETAILS_AGAIN PRICE 5.47
Trouble is make 2nd word each line capital letter first, then lower case for
every "_". Some 2nd word have "_" one or more time, other not. So we like
make line each lokk like:
ITEM1 Product PRICE 3.47
ITEM2 Product_Details PRICE 4.47
ITEM3 Product_Details_Again PRICE 5.47
How operate on second word after each "_"? We try:
echo "ITEM3 PRODUCT_DETAILS_AGAIN PRICE 5.47" | \
perl -aF_ -ne '$stuff=ucfirst(lc $2); s/$2/$stuff/; print $_'
but it not work make any change. Even:
echo "PRODUCT_DETAILS_AGAIN" | \
perl -aF_ -ne 'print ucfirst(lc $_);'
produce only "Product_details_again" instead "Product_Details_Again".
Someone can help please?
ITEM1 PRODUCT PRICE 3.47
ITEM2 PRODUCT_DETAILS PRICE 4.47
ITEM3 PRODUCT_DETAILS_AGAIN PRICE 5.47
Trouble is make 2nd word each line capital letter first, then lower case for
every "_". Some 2nd word have "_" one or more time, other not. So we like
make line each lokk like:
ITEM1 Product PRICE 3.47
ITEM2 Product_Details PRICE 4.47
ITEM3 Product_Details_Again PRICE 5.47
How operate on second word after each "_"? We try:
echo "ITEM3 PRODUCT_DETAILS_AGAIN PRICE 5.47" | \
perl -aF_ -ne '$stuff=ucfirst(lc $2); s/$2/$stuff/; print $_'
but it not work make any change. Even:
echo "PRODUCT_DETAILS_AGAIN" | \
perl -aF_ -ne 'print ucfirst(lc $_);'
produce only "Product_details_again" instead "Product_Details_Again".
Someone can help please?