Stripping out newlines from string

Problem
Different versions of UNIX handle the stripping of newlines in a string differently. Obviously if you echo a string, the shell automatically expands newlines “\n”.

Solution
sed and tr don’t appear to like performing these substitutions. But with Perl its a steal.

Example
% echo ‘hello world\nhello world\ntest it’ | perl -ane ’s#\\n# #g; print,”";’hello world hello [...]

Resize image command line – mogrify

Problem
You want to resize images from the command line.

Solution
Use image magik mogrify command.mogrify -resize “percentage” image_naAlso you can view current sizing – like this:% identify IMG_3864.JPGIMG_3864.JPG JPEG 563×422 563×422+0+0 DirectClass 8-bit 32.8887kb

Example
mogrify -resize 20% IMG_3705.JPG

Reference
Technorati Tags: mogrifymogrify man page – resize an image

Link to this post!


Search engine optimization by SEO Design Solutions