Skip to content

Tag: bash

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…

Replace variable in text file with another variable

I am trying to write a variable to a specific spot in a text file. So far I have the variable generation part done, but when I open the text file to see the result, the ${at} placeholder has been replaced with ${assetTag} and not the value of the variable. So the idea is that I compare the $serialNum to

Bash output all links in following format [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 wan…

Interleave lines sorted by a column

(Similar to How to interleave lines from two text files but for a single input. Also similar to Sort lines by group and column but interleaving or randomizing versus sorting.) I have a set of systems and tasks in two columns, SYSTEM,TASK: I want to distribute the tasks to each system in a balanced way. The id…

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