I want to find all files with specific name “stdout.1.0”, move it two/three levels up from its location. While moving it two/three levels up, I also want to rename it to “testjob.out”. All “stdout.1.0” files are located six levels down from parent directory. I used: and it outputs: The directories above is just representative of where the file is, but
Tag: bash
create multiple file with content in linux with user input
I’m new in bash scripting and I’m trying to create a bash script which can create multiple file with content (around 10000 lines [no matters what text]) but with user input. I made a script which create files (see below) but how can I fill each file with 10000 lines? Thank you in advance! Answer Replace your touch command with
Writing multiple lines to columns instead
I have an error report that contains lots of phone numbers, I need to see if any of this data exists in our database. Data required – Telephone number – Routing Code – Customer ID I’m using APIs that gather data from various sources. The first request is to use the telephone number we already know to grab the same
Removing leading 0 from third column
I’m trying to remove the first 0 from the third column in my CSV file tel.csv – I have been trying to use the following with no luck – Answer Something like: Or awk
Convert nth column of CSV from EPOCH to human readable in bash
I’ve tried to create a single line command to convert a particular column in a CSV from EPOCH to human readable. The file contains various columns, depending on the particular file. E.g. in this file EPOCH is in column 3 of 3, in another file it is in column 5 of 9. The basic conversion works when done manually, so
How can capture args with xargs across multiple pipe in bash
I have this command Suppose that argument from first xargs is $1 and it gets subsituted in like helm list –short -n {$1} and $2 is the argument of second Xargs and its gets substituted like but i also want $1 to use like this in last comand is this possible ? output of first xargs second xargs Answer I
Create a symbolic link named long_file pointing to the largest file in the current directory
I know how to create a symbolic link but I don’t kow how to get largetst file in current directory. Please, help me! Answer You can do it with the following command: which breaks down as follows: find /path/to/dir-with-big-file/ -type f -printf “%st%pn” – find files and print %s files size and %p name. sort -n -r | head -n
Process “aws ecs list-tasks” JSON output with “aws ecs execute-command”?
For example do this command. then it returns below then do next command using the ae340032378f4155bd2d0eb4ee60b5c7 of return sentence. I want to do this thing in one sentence, or shell script. Is it possible? I googled around the regular expression, but still unclear. Could you give some help? Answer Manipulate JSON with jq jq is the best tool for manipulating
How to monitor all network traffic from a specific process in linux?
I want to monitor and log all traffic that a specific process produces. I know about tcpdump, but it seems it doesn’t support filtering by process (pid/path, or at least user). It there any other way to log all traffic from a process? Ideally I should be able to filter ports as well. Thanks! Answer You should use strace command:
Execute a command on all the files within a directory
I am trying to write a bash script that could automate a programme on all the files present in a directory. The files that are in my directory are in the .nii or .nii.gz format. The command that I have to write is InputFile is the name of the file that has to be processed by the programme, and OutputFile