Sponsored Content
Full Discussion: Insert year in ls -l command
Top Forums UNIX for Beginners Questions & Answers Insert year in ls -l command Post 303042667 by RavinderSingh13 on Thursday 2nd of January 2020 10:07:24 PM
Old 01-02-2020
Quote:
Originally Posted by kumarinfa
@Ravindersingh13
Thank you for your suggestion, Yes i have save my output of ls command in file. and Can you please explain little bit in detail what we are doing in this solution.
Also what if my input is:
Code:
-rw-r--r-- 1 360 600 165923 Dec 31 11:29 12312019 file1_12312019_062449.csv

How can i extract year part in same solution, tried but could not get the expceted.
Thank you again
Hello kumarinfa,

Following is the complete explanation.

Code:
awk '                               ##starting awk program from here.
{
  split($NF,array,"[_.]")           ##Using split to splitting the last field of current line into an array named array with field separator of underscore and dot.
  $NF=array[2] OFS $NF              ##resetting last field value with 2nd value of array(which was year value) OFS and last field value itself.
}
1                                   ##Mentioning 1 will print edited/non-edited lines here. 
' Input_file                        ##Mentioning Input_file name here.

Thanks,
R. Singh

Last edited by RavinderSingh13; 01-02-2020 at 11:40 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

listing year in ls command

Hi all .. As per rule i searched the forum i am not able found out ... I want to display the year in when listing the files .. when i use ls -lt it is not displaying files with recent 6 month old .. I know that perderabo has written a script for that if you give that link it will be... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies

2. Shell Programming and Scripting

Printing Year in ls -ltr command

Hi, When retrieving parameters of a file using ls command i need to print the year part . When i do ls -ltr the following output is displayed -rwxrwxrwx 1 d_infd d_infd 1711 Jan 8 2004 wf1.class. Here the year part is not displayed only Jan 8 is displayed. Can any one... (9 Replies)
Discussion started by: ragugct
9 Replies

3. Shell Programming and Scripting

Last Command not giving year

Hi All, i want the last login details along with year. i tried below command but not giving me the year of last login. last <$Userid> | head -1 i heard that if it is current year then it wont display the year else it will display the year. is it so? if yes then , is there any way of... (1 Reply)
Discussion started by: ani_rvce
1 Replies

4. UNIX for Dummies Questions & Answers

Last Command not giving year

Hi All, i want the last login details along with year. i tried below command but not giving me the year of last login. last <$Userid> | head -1 i heard that if it is current year then it wont display the year else it will display the year. is it so? if yes then , is there any way of... (1 Reply)
Discussion started by: ani_rvce
1 Replies

5. UNIX for Dummies Questions & Answers

sed insert command and variable expansion/command substitution

I know this script is crummy, but I was just messing around.. how do I get sed's insert command to allow variable expansion to show the filename? #!/bin/bash filename=`echo $0` /usr/bin/sed '/#include/ { i\ the filename is `$filename` }' $1 exit 0 (8 Replies)
Discussion started by: glev2005
8 Replies

6. Emergency UNIX and Linux Support

LAST command with Year

Hi Guys, I'm trying to identify the last logins by all the users in the system in AIX. the last command gives me the output, but there is no year displayed for it . Since there is a duplication of months i mean Apr 2010 and Apr 2009 also its giving me inaccurate data.. Is there a way I can filter... (4 Replies)
Discussion started by: kkeng808
4 Replies

7. UNIX for Advanced & Expert Users

unix command : how to insert text at the cursor location via command line?

Hi, Well my title isn't very clear I think. So to understand my goal: I have a script "test1" #!/bin/bash xvkbd -text blabla with xbindkeys, I bind F5 key in order it runs my test1 script So when I press F5, test1 runs. I'm under Emacs/Vi and I press F5 in order to have "blabla" be... (0 Replies)
Discussion started by: xib.be
0 Replies

8. Linux

uptime command output when the server is running more than one year?

What is the uptime command output when the server is running more than one year? My doubt is whether it show in number of days format or number years and number of days format? For example, Assume the server is running 400 days 3 hrs 3 min 3 secs. The output like 400 days 3:3 min or 1 year 5... (3 Replies)
Discussion started by: maruthu
3 Replies

9. UNIX for Dummies Questions & Answers

Unix man command to find out month of the year?

how can i display month of the year i was born with using man command? thanks (2 Replies)
Discussion started by: janetroop95
2 Replies

10. UNIX for Dummies Questions & Answers

Command to print previous year in UNIX

hi all, I use date +%Y which gives Current year. Requirement: I want previous year to be printed. Please help me. Note: I tried date +%d/%m/%Y -d "-1 years" which is not working. (10 Replies)
Discussion started by: wasim999
10 Replies
MONGOEXCEPTION(3)							 1							 MONGOEXCEPTION(3)

The MongoException class

INTRODUCTION
Default Mongo exception. This covers a bunch of different error conditions that may eventually be moved to more specific exceptions, but will always extend Mon- goException. o The MongoSomething object has not been correctly initialized by its constructor Code: 0 Probably your Mongo object is not con- nected to a database server. o zero-length keys are not allowed, did you use $ with double quotes? Code: 1 You tried to save "" as a key. You generally should not do this. "" can mess up subobject access and is used by MongoDB internally. However, if you really want, you can set mongo.allow_empty_keys to true in your php.ini file to override this sanity check. If you override this, it is highly recommended that you set error checking to strict to avoid string interpolation errors. o '.' not allowed in key: <key> Code: 2 You attempted to write a key with '.' in it, which is prohibited. o insert too large: <size>, max: <max> Code: 3 You're attempting to send too much data to the database at once: the database will only accept inserts up to a certain size (currently 16 MB). o no elements in doc Code: 4 You're attempting to save a document with no fields. o size of BSON doc is <size> bytes, max <max>MB Code: 5 You're attempting to save a document that is larger than MongoDB can save. o no documents given Code: 6 You're attempting to batch insert an empty array of documents. o MongoCollection::group takes an array, object, or MongoCode key Code: 7 Wrong type parameter send to MongoCollection.group(3). o field names must be strings Code: 8 You should format field selectors as array("field1" => 1, "field2" => 1, ..., "fieldN" => 1). o invalid regex Code: 9 The regex passed to MongoRegex is not of the correct form. o MongoDBRef::get: $ref field must be a string Code: 10 o MongoDBRef::get: $db field must be a string Code: 11 o non-utf8 string: <str> Code: 12 This error occurs if you attempt to send a non-utf8 string to the database. All strings going into the database should be UTF8. See php.ini options for the transition option of quieting this exception. o mutex error: <err> Code: 13 The driver uses mutexes for synchronizing requests and responses in multithreaded environments. This is a fairly serious error and may not have a stack trace. It's unusual and should be reported to maintainers with any system information and steps to reproduce that you can provide. o index name too long: <len>, max <max> characters Code: 14 Indexes with names longer than 128 characters cannot be created. If you get this error, you should use MongoCollection.ensureIndex(3)'s "name" option to create a shorter name for your index. CLASS SYNOPSIS
MongoException MongoExceptionextends Exception PHP Documentation Group MONGOEXCEPTION(3)
All times are GMT -4. The time now is 05:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy