All Questions
143 questions
1
vote
2
answers
212
views
Redirect to a filename that will be a variable and contain a command substitution
I'm using nmap to scan a network and then create an XML file that contains the scanned information. I want that XML file to contain the date of the scan so that each file is unique and I can see the ...
-2
votes
1
answer
72
views
unable to evaluate line from file as input aithmetically
So I am writing a bash script that takes in a file with integers on each line and I am writing a function that converts those integers in each line into roman numerals, which i will need to write into ...
3
votes
2
answers
1k
views
I want to find lines where a specific word appears in a file along with line number and take the line numbers in an array .How to do that in bash?
This returns line numbers but they are in a string:
grep -n -F -w $word $file | cut -d : -f 1
1
vote
2
answers
439
views
Pinning a file to that it appears in the beginning in a folder
I am using Ubuntu (Linux mint). There is a mouse option, if I right-click on a file, I can then choose to pin a file (inside its folder), so that whatever file arranging method (alphabetical, by-date, ...
4
votes
1
answer
673
views
How to find files in subdirectories and copy it to the folder immediately before the location where the file was found
I have the following scheme of file directory:
.
|-- FOO1
| `-- p58
| `-- file1.csv
|-- FOO2
| `-- p63
| `-- file2.csv
Note that each of the CSV files is located in the subdirectory ...
1
vote
1
answer
110
views
Bash: How to read the script when sourcing it
When bash is executing a script, ls -la /proc/<pid of bash>/fd shows "255 -> /path/to/script".
I think that bash reads the script via file discriptor 255, and executes the commands ...
2
votes
2
answers
3k
views
Fastest way to write bash variable to a file
I want to generate some big files for some experiment.
This is my script. It creates a file then reads it to a variable and then tries to write it as many times defined in the loop in files:
#! /usr/...
0
votes
3
answers
380
views
Script to rename multiple files in current directory and subdirectories
The script should recursively go through each file in the directory/subdirectories (skip any symbolic links) and do the following replacements in the file names:
Multiple consecutive spaces with just ...
0
votes
1
answer
820
views
How can I loop over all directories and subdirectories and find files with a specific extension, then run FFMPEG on them, then copy them to a new lib
Ive been researching all of today and yesterday trying to find a solution, none have worked for me so far.
For example: https://stackoverflow.com/questions/5784661/how-do-you-convert-an-entire-...
0
votes
0
answers
133
views
Problem with read command while searching txt file line by line
I am trying to do a simple dictionary of words inserted by user which are collected in txt file and then the function to learn them. Words in two different languages are seperated by a chosen ...
1
vote
1
answer
496
views
Debounce inotifywait for large files
I upload files for deployment into a remote directory. That remote server has a script that watches the directory for new files:
inotifywait --monitor --event create --format '%f' --quiet /foo
When a ...
1
vote
1
answer
236
views
Reading file that other processes overwrite sometimes
I wrote a systemd-service/timer that will be update GPS location at using gpscsv --header 0 -n 1 > /tmp/location every 10 or 15sec.
when I inspect the text file with watch -n 1 cat /tmp/location, ...
0
votes
0
answers
211
views
Passing one or more files in function in bash
Here I have written a sample bash script, the problem with this is that I am able to successfully pass file to function remFun but I am unable to pass the file unique.txt to function printfile. In ...
0
votes
1
answer
66
views
turn `A B.py C D.py` to `A.py B.py C.py D.py` detecting from file extension in shell script [closed]
related to this thread answer
if the input is A B.py C D.py, the output turns into A.py B.py C.py D.py
I want to implement this feature in another script given below:
#!/bin/bash
echo -n "Round ...
-1
votes
2
answers
1k
views
Bash: Append rows from multiple files to one output file and add file name as column
This is a continuation of my previous question
Bash: Choose row with the highest value in specified column in multiple files and create one output file with rows containing the max
The solution I used ...