Skip to content
Advertisement

Tag: shell

Scripting to see if specific process is running as root [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 6 years ago. Improve this question I am currently trying to right a shell script which will

Find a line in a list of .gz files

i around 50 .gz files in a particular directory in linux. i need to find a particular line in each file. currently i am doing by zcat each file. Eg: Output: Sep 9 17:12:47 145.247.1.62 cap-s12-custfw-1: NetScreen device_id=cap-s12-custfw-1 [Root]system-information-00542: BGP peer 10.24.224.187 changed to Idle state (2016-09-09 17:13:15) please let me if there is any easier way to do this.

Shell script file with multiple commands

I want to make shell script file in windows and linux with multiple commands inside it. E.g run.sh and run.bat with the below commands run.bat or run.sh When I run my run.bat file it only executes first command mvn clean but it do not execute other commands. How to make shell-script file with multiple commands so that when I execute

How to remove files without certain extension?

How to remove all files without the .txt and .exe extensions recursively in the current working directory? I need a one-liner. I tried: Answer Try this. The above command will remove all the files other than the .exe and .txt extension files in the current directory and sub directory recursively.

Sort a find command to respect a custom order in Unix

I have a script that outputs file paths (via find), which I want to sort based on very specific custom logic: 1st sort key: I want the 2nd and, if present, the 3rd –separated field to be sorted using custom ordering based on a list of keys I supply – but excluding a numerical suffix. With the sample input below,

Linux grep command to find the value of key from json

I have a JSON output that contains a list of objects stored in a variable.(I may not be phrasing that right) Output of a curl command: will post in comment as I am unable to post here I want to grep the value at this position “ad6743fae9c54748b8644564c691ba58” shown in the output, which changes everytime i run the curl command. I

Advertisement