The below program redirects all my output to log file. I need to display all the output along with log file. How can this be achieved? Answer You could use tee:
Tag: shell
Use of $- in shell script
What is use of $- in Unix. In My system, the output is, what is meant by himBH? what it stands for. Thanks in Advance… Answer It returns the current shell’s flags. The $- variable contains the shell’s flags currently active in your terminal. These flags determine how your shell will function for you. In your case, these flags have
How to identify directory paths within multi-line string, replace with references to own file content, in Bash?
Given a bash variable containing the following multi-line string representing *nix paths: I’d like to be able to identify all directories (dir1 & dir2, for example) and to replace these directory path lines with the paths of the files below them. There should be no directory references in the final output, thus: I’m not sure exactly how to iterate over
How to print file/directory details using ls and AWK?
I am trying to print the output as below using the command: or But it does not print anything. O/P should be like, (I am using 0777 or 777 because of find . -type f -perm 0777) Answer you’ve got the right idea, but 777 is the octal representation of permissions, and with this you’re looking at the output of
Is there a bug in “zgrep -H”?
Just tried grep and zgrep on following test file: I also need the file-name printed, so I’ve added the -H switch and stepped on the following problem: E.g. depending on POSITION of -H switch in the command-line – the behavior is different for me and the issue always reproduces 🙁 One more test: Here’s the outline of which zgrep I’m
Replace a line with a number if part of it is matches using sed
I know this is a very simple question and been discussed many times, but I can’t understand where I am doing wrong in my command. I would like to replace the lines which starts with “It” as 99999. Each row starts with several blank spaces. I used But it is not working. Answer give this a try:
How to echo a dynamic variable’s content in shell script
How to echo a dynamic variable’s content in shell script ? Current output: Desired output: Answer Use eval:
Amazon AWS EC2 Key Pair Denied
I have scoured the Internet for answers and had little luck. All I have been trying to do is connect to my AWS EC2 Linux server via SSH. The.pem file is on my computer, but it has not been accepted. I have tried several FTP clients, including FileZilla and the native Terminal on my Mac. In FileZilla, my error is
Unix /Linux – several applications using the same environment variables but different values?
I am looking for some advice on the following below: I have several applications and tools on a server that requires the environment to be set up with variables etc for them to run. Many of these applications use the same environment variables to run but with different values. Some of these applications have multiple versions. e.g. prog v1.1, prog
Obtaining UNIQUE VALUE occurrences count in a set of COLUMNS using AWK
IGNORING columns 1 & 2 (only the rest of the columns); I would like to obtain the occurrence COUNT of UNIQUE EVEN values (ignoring ODD ones) for the following set of data. I have tried: I obtain 76 but I don’t expect this value. Answer You can try this awk command to count unique values ignoring 1st and 2nd column: