Sponsored Content
Full Discussion: One liners, quick rant...
The Lounge What is on Your Mind? One liners, quick rant... Post 302977420 by Scrutinizer on Monday 18th of July 2016 03:50:17 AM
Old 07-18-2016
I think one-liners tend to have a bad rep for the wrong reasons.

One-liners are typically used for programming on the command line, where a single line is your real estate. They are very useful as one-off, terse and personal small scripts for an ad-hoc parsing result, for example for general information, problem determination or security forensics. Developing such a small script is usually a lot quicker than editing a file, exiting, running it, re-editing, etc... Typically sysadmins use one-liners a lot for this purpose.

Once a one liner is working and if it proves to be useful for multiple occasions, then it can be turned into a script in a file and then vertical real estate can be used and short names can be replaced by mnemonic names and comments can be added for maintainability and it can be made fool-proof with error conditions. In a script file one-liners are to be a avoided.

These are just two different types of application.

If a one-liner is posted here, it shows the principle or mechanism that can be used to tackle a problem or create an application. The user is free to use it and turn it into a fully maintainable script if he so chooses, or execute it as such on the command line and get his/her result..

Last edited by Scrutinizer; 07-18-2016 at 06:31 AM..
This User Gave Thanks to Scrutinizer For This Post:
 

4 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Where can I rant?

First of all, apologies to the admins for not reading the rules totally and missing the bit about ranting off about other OSs. But that raises a question. Where do you go to have a good rant, to vent your disgust at various corporations and thier hideous behaviour? :confused: (2 Replies)
Discussion started by: u6ik
2 Replies

2. Shell Programming and Scripting

awk - one liners

Guys, I have a requirement like this. A file has >5K records always. Separated by "|", it has 30 fields for each line. In some lines, I am getting an odd field. say, the 15th field is supposed to be 2 characters but comes in as >2. In this case, for resolving this I need to copy the value of... (6 Replies)
Discussion started by: PikK45
6 Replies

3. What is on Your Mind?

Those simple one liners

I wanted to say LOL and punch my face when I saw post#11 (where Don_Cragun even reduced the string manipulation with a simple regex) in the thread https://www.unix.com/shell-programming-scripting/220553-add-0-start-filename-2.html I mean, when things can be done with just a one liner, sometimes I... (6 Replies)
Discussion started by: ahamed101
6 Replies

4. What is on Your Mind?

A rant...

Hi guys... (Apologies for any typos etc...) This is basically a rant. I have been doing kids level projects and writing code to suit since around 1982, for the uProfessor, for the Sinclair Spectrum and later for the QL, IBM-XT in MS-DOS and after that for a 386DX40 up to Windows 95, until I... (3 Replies)
Discussion started by: wisecracker
3 Replies
Finance::QuoteHist::MSN(3pm)				User Contributed Perl Documentation			      Finance::QuoteHist::MSN(3pm)

NAME
Finance::QuoteHist::MSN - Site-specific class for retrieving historical stock quotes. SYNOPSIS
use Finance::QuoteHist::MSN; $q = Finance::QuoteHist::MSN->new ( symbols => [qw(IBM UPS AMZN)], start_date => '01/01/1999', end_date => 'today', ); foreach $row ($q->quotes()) { ($symbol, $date, $open, $high, $low, $close, $volume) = @$row; ... } DESCRIPTION
Finance::QuoteHist::MSN is a subclass of Finance::QuoteHist::Generic, specifically tailored to read historical quotes from the MSN financial web site (http://moneycentral.msn.com/). Note that Quotemedia is currently the site that provides historical quote data for such other sites as Silicon Investor, which was the target of a module in an earlier release of this distribution. MSN does not currently provide information on dividends or splits. Please see Finance::QuoteHist::Generic(3) for more details on usage and available methods. If you just want to get historical quotes and are not interested in the details of how it is done, check out Finance::QuoteHist(3). METHODS
The basic user interface consists of a single method, as shown in the example above. That method is: quotes() Returns a list of rows (or a reference to an array containing those rows, if in scalar context). Each row contains the Symbol, Date, Open, High, Low, Close, and Volume for that date. Quote values are pre-adjusted for this site. REQUIRES
Finance::QuoteHist::Generic DISCLAIMER
The data returned from these modules is in no way guaranteed, nor are the developers responsible in any way for how this data (or lack thereof) is used. The interface is based on URLs and page layouts that might change at any time. Even though these modules are designed to be adaptive under these circumstances, they will at some point probably be unable to retrieve data unless fixed or provided with new parameters. Furthermore, the data from these web sites is usually not even guaranteed by the web sites themselves, and oftentimes is acquired elsewhere. Details for MSN's terms of use can be found here: http://privacy2.msn.com/tou/en-us/default.aspx If you still have concerns, then use another site-specific historical quote instance, or none at all. Above all, play nice. AUTHOR
Matthew P. Sisk, <sisk@mojotoad.com> COPYRIGHT
Copyright (c) 2006 Matthew P. Sisk. All rights reserved. All wrongs revenged. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
Finance::QuoteHist::Generic(3), Finance::QuoteHist(3), perl(1). perl v5.12.4 2010-06-06 Finance::QuoteHist::MSN(3pm)
All times are GMT -4. The time now is 09:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy