List file excluding first letter

1

I have a file called 1arquivo and it usually clears it with the ls command. How can I use ls excluding the first letter so that it returns me only arquivo . It has to be a generic solution because I will have several files in the same situation.

    
asked by anonymous 30.11.2017 / 17:49

1 answer

4

using cut your command would look like this:

ls ?arquivo | cut -c2-80

using awk command looks like this:

ls ?arquivo | awk '{ print substr($0,2,length($0)); }'

Only for didactic levels: using regular expression this ? is equivalent to any character ie? file can be (1file, 2file, 3file), and this * code is equivalent to anything (1file, 09999).

I hope I have helped.

    
30.11.2017 / 18:19