Skip to main content

All Questions

Tagged with
-1 votes
1 answer
75 views

Creating in Linux files in GB or MB range by various size by read a file [closed]

In Linux with Bash, there is the File numbers_in_one_line. In this file there is only one line with several numbers, all separated by spaces. These numbers are the value in bytes for creating files ...
user447274's user avatar
0 votes
1 answer
86 views

How to create splittet random files and join them with dmsetup

In Linux in Bash, there is a script, a part of the script is this while true ; do echo awk -v x=$(<"$TEMPDIR"size_container_in_byte) -v n=$(<"$TEMPDIR"parts) 'BEGIN{...
user447274's user avatar
-7 votes
2 answers
93 views

How can I pick random items from a list, but some more often than others, in a Bash config file? [closed]

In Linux, using Bash, I have two scripts: script.sh is the main script, and script_config.sh is the configuration for script.sh. In script.sh, I do source script_config.sh to load all the config ...
user447274's user avatar
-3 votes
1 answer
50 views

Rename files, remove the first four signs [duplicate]

There are many files in this format: IMG_20240717_191421.jpg IMG_20240620_165358_BURST001_COVER.jpg IMG_20240624_173513_2.jpg how can they renamed in Linux in Bash to: 20240717_191421.jpg ...
user447274's user avatar
0 votes
1 answer
48 views

Accessing a variable defined inside a sudo shell from outside

I'm trying to create a shell script with below requirement: ssh to a RHEL server sudo to an app user delete the contents of a directory (/tmp/logs) Copy the application logs from one directory (/app/...
user722814's user avatar
-1 votes
1 answer
72 views

Best tool to convert xlsx to csv

I need to install something that allow me through a script bash or if I can do it without install any external tool it would be great. The thing is I read about csvkit but is a tool of python and i ...
user714955's user avatar
4 votes
2 answers
599 views

Are Shell Script --long-options POSIX compatible?

In almost all POSIX specifications (e.g. ls), there are only short options (e.g. -A , -a , etc). In common shells like Bash, long options (e.g. --all , --almost-all , etc) are very common. And it is ...
midnite's user avatar
  • 593
-1 votes
1 answer
118 views

zip every month files and delete them [closed]

I have log patterns every day for artemis I want to zip them and delete the files and save one month files in one zip the files like this artemis.log.2024-11-22 artemis.log.2024-11-23 artemis.log.2024-...
MohammadReza Arefi's user avatar
0 votes
4 answers
120 views

Clean up bash script

Can someone clean up this part of bin bash script for me? I feel like i can write this so much cleaner. Basically, what i want to do is: If $pluginexcl2 is defined that 2 different grep -v will be ...
Shamir Husain's user avatar
2 votes
7 answers
730 views

Shell Script to Normalize the data

We have requirement to normalize the data ... Item field is comma delimited and irregular and it may have any items from 0 to max (lets say 100) Input: key1|desc field|item1,item2,item3,item4|extra ...
Sanjay Dubey's user avatar
2 votes
1 answer
167 views

select in a script

In Linux in Bash in a Script i use this: #!/bin/bash while true; do while true; do read -r -p 'enter number [4-999]: ' num if [[ $num =~ ^([4-9]|[1-9][0-9]{1,2})$ ]]; then ...
user447274's user avatar
-4 votes
2 answers
110 views

How to write in Linux in Bash in shellscript a part that can do something like this

How to write in Linux in Bash in shellscript a part that can do something like this enter a number must be in a range from 4-999 if not, ask again to enter enterednumber * 5 * randomnumber [1-9] (...
user447274's user avatar
0 votes
0 answers
46 views

How to only suppress warning outputs from cryptsetup?

In Linux in Bash i run a script with some cryptsetup calls like --luks2-metadata-size=16k --luks2-keyslots-size=256k .... luksFormat .... that brings Warning outputs. I know and understand, but i ...
user447274's user avatar
4 votes
1 answer
266 views

How to detect if headphones are plugged in for a shell script?

I'm writing my own custom status for i3/Sway that shows a volume indicator, and I've run into a snag. I'd like to know if there is a standard way, using standard Linux tools--maybe ALSA or sysfs--to ...
mrjpaxton's user avatar
  • 109
0 votes
1 answer
72 views

removing first and last character and empty spaces from a json file [closed]

I have given sets of different input files as shown sample below cat out.txt [ { "regional_unit": "node", "source_name": "1753250187_SPS", "...
vikrant rana's user avatar

15 30 50 per page
1
2 3 4 5
130