2
votes
Accepted
Use fallocate with numbers from text file
If you're trying to loop over a sequence of whitespace separated numbers in a single line of list.txt then one way to do so in the bash shell would be to read them into an indexed array:
read -a ...
1
vote
Get a list of all user's commands from a non-interactive shell
Turns out, I was quite close to the solution. I was confusing login shells and interactive shells. Different things. Instead of $SHELL --login, all I needed to do was $SHELL -i. The following will ...
1
vote
Accepted
join a specific number of files/devices in linear mode together in a linux system
You can use a for loop to iterate from zero to 32, and store the device names in an array.
# you don't show the file, there are programmatic ways to acquire this number
n=33
devices=()
for ((i = 0; i ...
1
vote
Accepted
Using awk, append a value in last field in csv file based upon value in specific field
Here's one awk approach:
## This function takes as input an awk array whose indices are
## IDs and whose value is the number of times that ID has been seen.
## It returns the ID with the maximum value....
1
vote
Using awk, append a value in last field in csv file based upon value in specific field
This sounds too complicated to do it reliably and quickly in awk.
You'll want to treat your "row groups" individually. A program in a mainstream programming language with a reasonable CSV ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
shell-script × 16628bash × 6888
shell × 2409
linux × 1924
scripting × 1156
text-processing × 1117
awk × 995
sed × 846
files × 496
grep × 479
command-line × 421
ssh × 381
find × 373
variable × 339
ubuntu × 308
zsh × 300
cron × 286
regular-expression × 246
quoting × 230
ksh × 226
pipe × 222
io-redirection × 215
terminal × 203
date × 197
rename × 181