Skip to content

Tag: bash

ls command ignore specific directory [bash]

Tree: ls : Ignore specific file: ls -I c.txt : Ignore specific directory: ls -I Tests : (does not work – Tests directory should not appear) Answer The “man page” for the ls command explains that the -I flag accepts a pattern. So you can use a wildcard in your command: See: man ls or the comm…

Linux – Sort files by part of name (no delimiters)

I want to get a sorted list of files. Files have the following naming convention: DATENUMBER.txt (without spaces). E.g., file 3 on 2015-12-09 looks like: 201512093.txt The version sort option of ls doesn’t help me: sort -V, –key=1.[number] do not work too as I have different filename length. As I …

How to append a column for the result set in shell script

I need a script for the below scenario. I am very new to shell script. the above query results with following result Now I need to get result as follows: 1st column, 3rd column ,4th column of above result set and new column with default values Here the last column values is always known values i.e for file1 D…