LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-17-2013, 08:29 PM   #16
danielbmartin
Senior Member
 
Registered: Apr 2010
Location: Apex, NC, USA
Distribution: Mint 17.3
Posts: 1,881

Rep: Reputation: 660Reputation: 660Reputation: 660Reputation: 660Reputation: 660Reputation: 660

Quote:
Originally Posted by grail View Post
Code:
awk -F "" '{f="%"(/\./?".2":".0")"f%s\n";printf f,$0,$NF}' file
grail, I hammered your clever solution to even fewer keystrokes...
Code:
awk -F "" '{printf "%."(/\./*2)"f%s\n",$0,$NF}' file
Daniel B. Martin
 
Old 10-18-2013, 02:19 AM   #17
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192
Quote:
Originally Posted by danielbmartin View Post
grail, I hammered your clever solution to even fewer keystrokes...
Code:
awk -F "" '{printf "%."(/\./*2)"f%s\n",$0,$NF}' file
Daniel B. Martin
Nice
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing a file character by character with a bash builtin command (script). stf92 Linux - Newbie 4 06-30-2012 08:41 PM
[SOLVED] BC provides incorrect decimal results, but only on the last two decimal places... standard_output Linux - Newbie 4 06-27-2012 05:30 PM
[SOLVED] Mplayer place in KDE, lost icon, wrong place. firekage Slackware 4 01-24-2012 02:23 PM
PS2 mouse goes crazy [it goes round n round n round...] goci Linux - Hardware 2 10-09-2003 08:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration