Skip to content

Tag: shell

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:

How we can use correctly pipe in Linux?

I have a project, the goal it is to extract phone numbers of a data.txt file, so I did a program. Like that : My problem is when I want to use this program and to execute on my terminal I had to use pipe for my terminal command. I tried many different commands on my terminal and the last

Unix – Replace column value inside while loop

I have comma separated (sometimes tab) text file as below: parameters.txt: with below code I try to loop through the file and do something I wanted to update the last column of the file to N if the above operation is successful, however below approaches are not working for me: sed ‘s/$f5/N/’ &#821…

IF statement for different lines [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 years ago. Improve this question Question is simple, but I can’t find a fast and elegant way to solve. I want to decide…

List and change directory and run command in Shell

I am coming back to shell after almost 6 years or so. I have a directory structure let’s say, MainDirectory –> subDirectory1/some.xml                      –> subDirectory2/some.xml                      …                      …                      –> subDirectoryN/…