Skip to content

Tag: awk

Bash get docker image ID automatically

I’m trying to run a few docker commands in my linux machine: But I would like to make a runme.sh and execute all in one run. The problem is that ImageID bf46cff9b182 is dynamiccally changing everytime. So I need to somehow pipe it from the output of the load command, which is in fact possible. The outpu…

Printing awk output in same line after grep

I have a very crude script getinfo.sh that gets me information from all files with name FILENAME1 and FILENAME2 in all subfolders and the path of the subfolder. The awk result should only pick the nth line from FILENAME2 if the script is called with “getinfo.sh n”. I want all the info printed in o…

changing two lines of a text file

I have a bash script which gets a text file as input and takes two parameters (Line N° one and line N° two), then changes both lines with each other in the text. Here is the code: It works fine for every two lines which are not consecutive. but for lines which follows after each other (for ex line 5

Get a particular string from text file

I need to get a particular string from a text file. the content of my file is below : The command that i am trying is : Using this command, I am able to get that particular line in which my string is present. Here is the result of the awk command : What I want to grep is only

How to use sed/awk/grep [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 4 years ago. Improve this question I hav…

Print a column without 1st item of that column

Good night everybody, i want to print a column without printing the 1st item of that column. I want print the 4th column of this csv file: So i do this: But this print: But i only want the numbers, so i want to print all except the first line (MediaAcesso), how can i do this? Can i do this

How to pass “-L” to an awk script?

I am trying to write an awk script that accepts -L as an argument. As an example to show you what I want, here is a simple awk script called awktest: If I run this from shell: I get as output: Which is what I expect. It seems to work for anything I put in except -L. If I run:

Fetch latest matching string value

I have a file which contains two values for initial… keyword. I want to grab the latest date for matching initial… string. After getting the date I also need to format the date by replacing / with – In the above example, my output should be 2018-02-05. Here, I am fetching the line which cont…