Skip to content

Tag: unix

How To Substitute Piped Output of Awk Command With Variable

I’m trying to take a column and pipe it through an echo command. If possible, I would like to keep it in one line or do this as efficiently as possible. While researching, I found that I have to use single quotes to expand the variable and to escape the double quotes. Here’s what I was trying: But…

ls -al output column fields

Can someone guide me what does each column of ls -ali output in linux describe? Answer ls -ali something like this -a, –all do not ignore entries starting with . -i, –inode print the index number of each file inode, authority, num ,user,group, size , date file name you can use “man ls”…

empty an existing array in ksh

I have script which stores the list of files in an array as shown below I have to empty this my_array variable to use it for other purpose. I cannot declare another new array. Is there any way to clear the content of the array and reuse it again? Thanks in advance. Answer Since you’re already using set …

Listing files with numeric names

How do I list files that have only numeric names e.g I have tried ls -l [0-9]* but this seems to bring all file names that start with a digit and can have anything in their name after a digit. Answer First, turn on Bash’s extglob option: Then use this pattern: Read more about extended pattern matching i…

Awk in loopwith different file

I have four files and want to run a awk code on each file. But this code is not working. My code: Answer Awk can work with multiple files no need of for syntax will be like this or In your case To correct your existing code change To