Skip to content
Advertisement

Tag: unix

Bash – if statement not automatically operating

I’m having a very odd problem with a bash script, written on Ubuntu 17.04 machine. I have a txt file that contains information about people in this fashion: number name surname city state With these infos I have to create an organization system that works by state. For example, with a list like this 123 alan smith new_york NEW_YORK 123

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, I keep

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” see more infomations

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 -A …

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 in the Bash

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

Advertisement