Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
229
votes
11
answers
185994
views
List files sorted numerically
I have a bunch of files from `log1` to `log164`. I'm trying to LIST the directory (sorted) in a UNIX terminal but the sort functions are only providing the format like this: home:logs Home$ ls -1 | sort log1.gz log10.gz log100.gz log101.gz log102.gz log103.gz log104.gz log105.gz log106.gz ...etc Wha...
I have a bunch of files from
log1
to log164
.
I'm trying to LIST the directory (sorted) in a UNIX terminal but the sort functions are only providing the format like this:
home:logs Home$ ls -1 | sort
log1.gz
log10.gz
log100.gz
log101.gz
log102.gz
log103.gz
log104.gz
log105.gz
log106.gz
...etc
What I want is
home:logs Home$ ls -1 | sort
log1.gz
log2.gz
log3.gz
log4.gz
log5.gz
log6.gz
log7.gz
...{more here}
log99.gz
log100.gz
log101.gz
log102.gz
...etc
Any suggestions in what I could use to do this?
Rabiani
Mar 9, 2012, 02:18 AM
• Last activity: Mar 7, 2025, 02:38 PM
1
votes
1
answers
560
views
FISH CLI What do the error numbers at the prompt mean?
I am just trying out the **FISH** - (the FriendlyInteractiveSHell) - CLI & whenever I type in an erroneous Command, a new Prompt appears under the faulty Command prompt with a number in square brackets. I have searched through FISH's FAQs etc., but no joy in explaining the meaning of the error-numbe...
I am just trying out the **FISH** - (the FriendlyInteractiveSHell) - CLI & whenever I type in an erroneous Command, a new Prompt appears under the faulty Command prompt with a number in square brackets. I have searched through FISH's FAQs etc., but no joy in explaining the meaning of the error-number? If I hit Enter, the prompt just reappears with the error number until I enter a random correct command, such as 'ls'.
beagleburt
(13 rep)
Dec 3, 2023, 07:19 PM
• Last activity: Dec 3, 2023, 08:22 PM
4
votes
3
answers
913
views
Override page numbers of a djvu document
I have a djvu scan of a book. Let's consider two cases: 1. I'd like to number the pages `0, 1, 2, ...` (usage case: the cover should get be page 0) 2. I'd like to number some pages with Roman numbers and some with Arabic numbers, for example: `i, ii, iii, ..., x, 1, 2, 3, ...` (usage case: some intr...
I have a djvu scan of a book. Let's consider two cases:
1. I'd like to number the pages
0, 1, 2, ...
(usage case: the cover should get be page 0)
2. I'd like to number some pages with Roman numbers and some with Arabic numbers, for example: i, ii, iii, ..., x, 1, 2, 3, ...
(usage case: some introductory pages are numbered Roman in the book)
Is it possible to do it on Linux?
marmistrz
(2792 rep)
Jun 17, 2015, 08:14 AM
• Last activity: Nov 27, 2023, 10:05 AM
0
votes
1
answers
45
views
Would it be feasible to create a script that can right click the mouse at a very specific location when an even more specific number gets generated?
I'm aware of a program that can simulate a right-click at specific coordinates on my display at any given interval. However, I'm wondering if it's possible to write a script that can perform a right-click at a specific position on my display when a very specific number is generated as a result of th...
I'm aware of a program that can simulate a right-click at specific coordinates on my display at any given interval.
However, I'm wondering if it's possible to write a script that can perform a right-click at a specific position on my display when a very specific number is generated as a result of the first right-click?
For example, this website generates temporary phone numbers, which can also be purchased if you care to. After ten seconds or so, you can right click to have another five, ten digit phone numbers generated. Is there a way to have a script recognize when an exact ten digit number is generated, even if its very unlikely that the number will ever be generated?
Brass tacks is I'm trying everything I can to get an old phone number that is "available" (not owned by anyone else yet) but I'm unable to have my old phone carrier help in the process. I need a security code for an important g-mail account which uses my old phone number as a recovery option. This temp phone number website has generated a couple phone numbers that have had the first 6 digits correct so I figured it would be worth a shot making a script that could be run in the background waiting for the correct ten digit number to be generated, if by chance it ever does.
Ryan
(1 rep)
May 28, 2023, 12:38 PM
• Last activity: May 29, 2023, 05:51 AM
0
votes
1
answers
31
views
How can numbered files be moved and renamed to subsequent numbered files to correct directory?
In ~/wrongdir there are mpv-shot0001.jpg, mpv-shot0002.jpg, mpv-shot0003.jpg, mpv-shot0004.jpg, mpv-shot0005.jpg where the screenshot key was pressed when a mpv was initiated in ~/wrongdir. The screenshots need added to ~/correctdir where there are screenshots already from mpv-shot0001.jpg to mpv-sh...
In ~/wrongdir there are mpv-shot0001.jpg, mpv-shot0002.jpg, mpv-shot0003.jpg, mpv-shot0004.jpg, mpv-shot0005.jpg
where the screenshot key was pressed when a mpv was initiated in ~/wrongdir.
The screenshots need added to ~/correctdir where there are screenshots already from mpv-shot0001.jpg to mpv-shot9001.jpg.
A mere
~/wrongdir/mpv-shot* ~/correctdir/
would clobber the files in ~/correctdir.
How can the screenshot files from ~/wrongdir be appended to the list of numbered screenshot files in ~/correctdir, following on the existing number sequence (in this example, as mpv-shot9002.jpg to mpv-shot9006.jpg)?
Digit
(431 rep)
Mar 31, 2023, 03:30 PM
• Last activity: Mar 31, 2023, 05:20 PM
2
votes
2
answers
126
views
How Can I Find Five Numbers Between Two Numbers
Suppose I have these two numbers: 800000 and 3200000. I want to find five numbers with an even difference in between these two numbers. Therefore, I want the output to be: ``` 800000 1200000 1600000 2000000 2400000 2800000 3200000 ``` I know about the `seq` command but I'm not sure how to do this.
Suppose I have these two numbers: 800000 and 3200000. I want to find five numbers with an even difference in between these two numbers. Therefore, I want the output to be:
800000
1200000
1600000
2000000
2400000
2800000
3200000
I know about the seq
command but I'm not sure how to do this.
Amarakon
(373 rep)
Jun 16, 2022, 05:31 PM
• Last activity: Jun 19, 2022, 03:43 PM
0
votes
2
answers
399
views
match number range with non significative zeros in zsh
I have in a directory files like this : ``` booklet-001.pdf booklet-002.pdf booklet-003.pdf … booklet-997.pdf booklet-998.pdf booklet-999.pdf ``` Then, I whant to match the files numbered from 079 to 256. But how to do it with the zsh’s regex matching?
I have in a directory files like this :
booklet-001.pdf
booklet-002.pdf
booklet-003.pdf
…
booklet-997.pdf
booklet-998.pdf
booklet-999.pdf
Then, I whant to match the files numbered from 079 to 256. But how to do it with the zsh’s regex matching?
fauve
(1529 rep)
May 2, 2022, 01:45 AM
• Last activity: May 4, 2022, 10:32 AM
0
votes
2
answers
301
views
Any text utility or hack to numbering poems lines omitting certain numbers?
My goal is try to see if there are common text utilities in linux that can be used to number lines of poems like this: ``` OF Mans First Disobedience, and the Fruit Of that Forbidden Tree, whose mortal tast Brought Death into the World, and all our woe, With loss of Eden, till one greater Man Restor...
My goal is try to see if there are common text utilities in linux that can be used to number lines of poems like this:
OF Mans First Disobedience, and the Fruit
Of that Forbidden Tree, whose mortal tast
Brought Death into the World, and all our woe,
With loss of Eden, till one greater Man
Restore us, and regain the blissful Seat,
Sing Heav'nly Muse, that on the secret top
Of Oreb, or of Sinai, didst inspire
That Shepherd, who first taught the chosen Seed,
In the Beginning how the Heav'ns and Earth
Rose out of Chaos: or if Sion Hill
Delight thee more, and Siloa's brook that flow'd
Fast by the Oracle of God; I thence
Invoke thy aid to my adventrous Song,
That with no middle flight intends to soar
Above th' Aonian Mount, while it pursues
Things unattempted yet in Prose or Rhime.
And chiefly Thou, O Spirit, that dost prefer
Before all Temples th' upright heart and pure,
Instruct me, for Thou know'st; Thou from the first
Wast present, and with mighty wings outspread
Dove-like satst brooding on the vast Abyss
And mad'st it pregnant: What in me is dark
Illumin, what is low raise and support;
That to the highth of this great Argument
I may assert Eternal Providence,
And justifie the wayes of God to men.
Obtaining this:
OF Mans First Disobedience, and the Fruit
Of that Forbidden Tree, whose mortal tast
Brought Death into the World, and all our woe,
4 With loss of Eden, till one greater Man
Restore us, and regain the blissful Seat,
Sing Heav'nly Muse, that on the secret top
Of Oreb, or of Sinai, didst inspire
8 That Shepherd, who first taught the chosen Seed,
In the Beginning how the Heav'ns and Earth
Rose out of Chaos: or if Sion Hill
Delight thee more, and Siloa's brook that flow'd
12 Fast by the Oracle of God; I thence
Invoke thy aid to my adventrous Song,
That with no middle flight intends to soar
Above th' Aonian Mount, while it pursues
16 Things unattempted yet in Prose or Rhime.
And chiefly Thou, O Spirit, that dost prefer
Before all Temples th' upright heart and pure,
Instruct me, for Thou know'st; Thou from the first
20 Wast present, and with mighty wings outspread
Dove-like satst brooding on the vast Abyss
And mad'st it pregnant: What in me is dark
Illumin, what is low raise and support;
24 That to the highth of this great Argument
I may assert Eternal Providence,
And justifie the wayes of God to men.
Can, awk, also indent lines in this way
OF Mans First Disobedience, and the Fruit
Of that Forbidden Tree, whose mortal tast
Brought Death into the World, and all our woe,
4 With loss of Eden, till one greater Man
Restore us, and regain the blissful Seat,
Sing Heav'nly Muse, that on the secret top
Of Oreb, or of Sinai, didst inspire
8 That Shepherd, who first taught the chosen Seed,
And like this too?
OF Mans First Disobedience, and the Fruit
Of that Forbidden Tree, whose mortal tast
Brought Death into the World, and all our woe,
4 With loss of Eden, till one greater Man
Restore us, and regain the blissful Seat,
Sing Heav'nly Muse, that on the secret top
Of Oreb, or of Sinai, didst inspire
8 That Shepherd, who first taught the chosen Seed,
Dingo
(339 rep)
Dec 9, 2021, 12:53 AM
• Last activity: Feb 8, 2022, 07:33 PM
1
votes
3
answers
69
views
Restarting poem line numbering any 4 lines after a blank space
This is related to very interesting answer given here: https://unix.stackexchange.com/questions/680747/any-text-utility-or-hack-to-numbering-poems-lines-omitting-certain-numbers/680752# ```awk 'FNR % 4 == 0 { printf "%6i %s\n", FNR, $0 ; next }; {printf "%6s %s\n", "", $0}' poem.txt``` That does the...
This is related to very interesting answer given here: https://unix.stackexchange.com/questions/680747/any-text-utility-or-hack-to-numbering-poems-lines-omitting-certain-numbers/680752#
'FNR % 4 == 0 { printf "%6i %s\n", FNR, $0 ; next }; {printf "%6s %s\n", "", $0}' poem.txt
That does the job of numbering poem lines automatically.
However, in case we have several poems separated by blank lines, in this way:
OF Mans First Disobedience, and the Fruit
Of that Forbidden Tree, whose mortal tast
Brought Death into the World, and all our woe,
With loss of Eden, till one greater Man
Restore us, and regain the blissful Seat,
Sing Heav'nly Muse, that on the secret top
Of Oreb, or of Sinai, didst inspire
That Shepherd, who first taught the chosen Seed,
In the Beginning how the Heav'ns and Earth
Rose out of Chaos: or if Sion Hill
Delight thee more, and Siloa's brook that flow'd
Fast by the Oracle of God; I thence
Invoke thy aid to my adventrous Song,
That with no middle flight intends to soar
Above th' Aonian Mount, while it pursues
Things unattempted yet in Prose or Rhime.
I wonder if line numbering any four lines can be restarted after a blank space, in order to have:
OF Mans First Disobedience, and the Fruit
Of that Forbidden Tree, whose mortal tast
Brought Death into the World, and all our woe,
4 With loss of Eden, till one greater Man
Restore us, and regain the blissful Seat,
Sing Heav'nly Muse, that on the secret top
Of Oreb, or of Sinai, didst inspire
8 That Shepherd, who first taught the chosen Seed,
In the Beginning how the Heav'ns and Earth
Rose out of Chaos: or if Sion Hill
Delight thee more, and Siloa's brook that flow'd
4 Fast by the Oracle of God; I thence
Invoke thy aid to my adventrous Song,
That with no middle flight intends to soar
Above th' Aonian Mount, while it pursues
8 Things unattempted yet in Prose or Rhime.
Dingo
(339 rep)
Feb 4, 2022, 08:22 AM
• Last activity: Feb 8, 2022, 06:16 PM
3
votes
3
answers
691
views
Numbering poems stanzas using roman numerals
I would be able to numbering, sequentially, any stanza of a certain poem using roman numerals like this: ``` Injurious love, why still to mar accord Between desires has been thy favourite feat? Why does it please thee so, perfidious lord, Two...
I would be able to numbering, sequentially, any stanza of a certain poem using roman numerals like this:
Injurious love, why still to mar accord
Between desires has been thy favourite feat?
Why does it please thee so, perfidious lord,
Two hearts should with a different measure beat?
Thou wilt not let me take the certain ford,
Dragging me where the stream is deep and fleet.
Her I abandon who my love desires,
While she who hates, respect and love inspires.
Thou to Rinaldo show'st the damsel fair,
While he seems hideous to that gentle dame;
And he, who when the lady's pride and care,
Paid back with deepest hate her amorous flame,
Now pines, himself, the victim of despair,
Scorned in his turn, and his reward the same.
By the changed damsel in such sort abhorred,
She would choose death before that hated lord.
He to the Pagan cries: "Forego thy theft,
And down, false felon, from that pilfer'd steed;
I am not wont to let my own be reft.
And he who seeks it dearly pays the deed.
More -- I shall take from thee yon lovely weft;
To leave thee such a prize were foul misdeed;
And horse and maid, whose worth outstrips belief,
Were ill, methinks, relinquished to a thief."
"Thou liest," the haughty Saracen retorts,
As proud, and burning with as fierce a flame,
"A thief thyself, if Fame the truth reports:
But let good deeds decide our dubious claim,
With whom the steed or damsel fair assorts:
Best proved by valiant deeds: though, for the dame,
That nothing is so precious, I with thee
(Search the wide world throughout) may well agree."
Into this: with roman capital numbers aligned to the last verse of stanza?
Injurious love, why still to mar accord
Between desires has been thy favourite feat?
Why does it please thee so, perfidious lord,
Two hearts should with a different measure beat?
Thou wilt not let me take the certain ford,
Dragging me where the stream is deep and fleet.
Her I abandon who my love desires,
I While she who hates, respect and love inspires.
Thou to Rinaldo show'st the damsel fair,
While he seems hideous to that gentle dame;
And he, who when the lady's pride and care,
Paid back with deepest hate her amorous flame,
Now pines, himself, the victim of despair,
Scorned in his turn, and his reward the same.
By the changed damsel in such sort abhorred,
II She would choose death before that hated lord.
He to the Pagan cries: "Forego thy theft,
And down, false felon, from that pilfer'd steed;
I am not wont to let my own be reft.
And he who seeks it dearly pays the deed.
More -- I shall take from thee yon lovely weft;
To leave thee such a prize were foul misdeed;
And horse and maid, whose worth outstrips belief,
III Were ill, methinks, relinquished to a thief."
"Thou liest," the haughty Saracen retorts,
As proud, and burning with as fierce a flame,
"A thief thyself, if Fame the truth reports:
But let good deeds decide our dubious claim,
With whom the steed or damsel fair assorts:
Best proved by valiant deeds: though, for the dame,
That nothing is so precious, I with thee
IV (Search the wide world throughout) may well agree."
I wonder if there are any way to make this in linux with text utilities. It maybe can be not suitable for awk, generating numerals in roman style, but I already found somewhere on internet a bash script to generate roman numerals
#/bin/bash
# roman.sh
#
# Function
#
num2roman() { # NUM
# Returns NUM in roman letters
#
input=$1 # input num
output="" # Clear output string
len=${#input} # Initial length to count down
roman_val() { # NUM one five ten
# This sub does the basic 'roman' algorythm
#
N=$1
one=$2
five=$3
ten=$4
out=""
case $N in
0) out+="" ;;
) while [[ $N -gt 0 ]]
do out+="$one"
N=$(($N-1))
done
;;
4) out+="$one$five" ;;
5) out+="$five" ;;
) out+="$five"
N=$(($N-5))
while [[ $N -gt 0 ]]
do out+="$one"
N=$(($N-1))
done
;;
9) while [[ $N -lt 10 ]]
do out+="$one"
N=$(($N+1))
done
out+="$ten"
;;
esac
echo $out
}
while [[ $len -gt 0 ]]
do # There are letters to add
num=${input:0:1}
# Do action according position
case $len in
1) # 1
output+="$(roman_val $num I V X)"
;;
2) # 10
output+="$(roman_val $num X L C)"
;;
3) # 100
output+="$(roman_val $num C D M)"
;;
*) # 1000+
# 10'000 gets a line above, 100'000 gets a line on the left.. how to?
num=${input:0:(-3)}
while [[ $num -gt 0 ]]
do output+="M"
num=$(($num-1))
done
;;
esac
input=${input:1} ; len=${#input}
done
echo $output
}
#
# Call it
#
num2roman $1
That I invoke with this syntax:
for N in seq 1 10
;do ./roman.sh $N; done
Whose output is:
I
II
III
IV
V
VI
VII
VIII
IX
X
So, from another point of view, it could be only matter of picking, from generated roman numerals list, any item and then put any of these aligned with the last verse of any stanza
Dingo
(339 rep)
Dec 15, 2021, 01:19 AM
• Last activity: Dec 21, 2021, 08:45 AM
0
votes
3
answers
478
views
Change number written in scientific notation in filenames
I'm going to make a video of image files, but the filenames contain numbers in scientific notation, so the ordering of the name will not be correct. The filenames are in this format: ABC_1.000000E-01.png ~ ABC_1.100000E+01.png, DEF_1.000000E-01.png ~ DEF_1.100000E+01.png, GHI_1.000000E-01.png ~ GHI_...
I'm going to make a video of image files, but the filenames contain numbers in scientific notation, so the ordering of the name will not be correct.
The filenames are in this format:
ABC_1.000000E-01.png ~ ABC_1.100000E+01.png,
DEF_1.000000E-01.png ~ DEF_1.100000E+01.png,
GHI_1.000000E-01.png ~ GHI_1.100000E+01.png,
.
.
.
If I change the number notation used for the numbers, the order is not correct again, so I want to change it as below.
ABC_001.png ~ ABC_110.png,
DEF_001.png ~ DEF_110.png,
GHI_001.png ~ GHI_110.png,
.
.
.
How may I do this on my Linux system?
Kitae Kim
(3 rep)
Dec 17, 2021, 04:19 AM
• Last activity: Dec 17, 2021, 10:29 AM
1
votes
3
answers
782
views
Numbering a bunch of files according to the date modified timestamp?
So I downloaded a bunch of documents in chronological order, but I have to copy and edit them, which would change the date modified. I would like to prefix them with a number (001_, 002_...) in the order I downloaded them in.
So I downloaded a bunch of documents in chronological order, but I have to copy and edit them, which would change the date modified. I would like to prefix them with a number (001_, 002_...) in the order I downloaded them in.
user471414
(31 rep)
May 12, 2021, 06:14 PM
• Last activity: May 13, 2021, 05:18 AM
3
votes
2
answers
420
views
Collapsing a series of comma separated numbers in a sequence to Beginning-End
Problem I am trying to solve/enhance a BASH script that provides a number sequence: I am using a topologically aware tool (lstopo-no-graphics) to extract physical processor numbers to use for input to numactl for processor binding. Example output for L3 L#4 shared cache physical core lstopo-no-graph...
Problem I am trying to solve/enhance a BASH script that provides a number sequence:
I am using a topologically aware tool (lstopo-no-graphics) to extract physical processor numbers to use for input to numactl for processor binding.
Example output for L3 L#4 shared cache physical core
lstopo-no-graphics --no-io|sed -n "/L3 L#3/,/L3/p"|grep -v "L3\|L2"|tr -s '[:space:]'|cut -d " " -f4|grep -o "[0-9]*"|sort -g|tr '\n' ','|sed '$s/,$//'
results in the number series string:
32,33,34,35,36,37,38,39,96,97,98,99,100,101,102,103
All well and good, I use this series for the
numactl --physcpubin=32,33,34,35,36,37,38,39,96,97,98,99,100,101,102,103
، I would would like to be able to collapse the sequence down to numactl --physcpubin=32-39,96-103
, looking to collapse multiple comma separated number sequences to an "a-n" series when sequential, with each sequence comma separated.
I don't have a problem with the existing bash script, just looking for a cleaner implementation if anyone has any ideas?
Goomba1050
(33 rep)
Apr 27, 2021, 04:26 PM
• Last activity: May 8, 2021, 03:23 PM
-2
votes
2
answers
607
views
number lines in a file
So I have a file `text.txt` with lines of some characters example: abc abc yxz abc now I would like to number the lines like this and copy it to another file. End expected result: 1 abc 2 abc 3 yxz 4 abc
So I have a file
text.txt
with lines of some characters
example:
abc
abc
yxz
abc
now I would like to number the lines like this and copy it to another file.
End expected result:
1 abc
2 abc
3 yxz
4 abc
truninging
(33 rep)
Nov 17, 2016, 04:33 PM
• Last activity: Dec 24, 2020, 09:19 AM
1
votes
1
answers
398
views
How to show a line number in bash TUI?
I'm trying to add support for line number on a bash [project][1] i like (mainly as a fun exercise). To start, i looked into the function that was setting up the status line (since i thought of inspiring myself from it, since it would be printing a constant line, at the bottom of the window, horizont...
I'm trying to add support for line number on a bash project i like (mainly as a fun exercise).
To start, i looked into the function that was setting up the status line (since i thought of inspiring myself from it, since it would be printing a constant line, at the bottom of the window, horizontally):
status_line() {
# '\e7' : Save cursor position.
# This is more widely supported than '\e[s'.
# '\e[%sH' : Move cursor to bottom of the terminal.
# '\e[30;41m' : Set foreground and background colors.
# '%*s' : Insert enough spaces to fill the screen width.
# This sets the background color to the whole line
# and fixes issues in 'screen' where '\e[K' doesn't work.
# '\r' : Move cursor back to column 0 (was at EOL due to above).
# '\e[m' : Reset text formatting.
# '\e[%sH\e[K' : Clear line below status_line.
# '\e8' : Restore cursor position.
# This is more widely supported than '\e[u'.
buffer_name="${file_name:-New Buffer}"
(( modified == 1 )) && buffer_name+="*"
counter="Ln $((file_line+1)), Col $((file_column+1))"
printf "\e7\e[%sH%s%*s%s\e[%sH\e[K\e8"\
"$((LINES-1))"\
"[$buffer_name]"\
"$((COLUMNS-${#buffer_name}-${#counter}-4))" ""\
"[$counter]"\
"$LINES"
}
A part of the project's code. Now I'm aware i could just use \n
and replace the H
in the printf statements to something that would make it work vertically (since i need a line number, it would obviously be preferable *vertically*), but I don't know much about printf syntax (in this context, not talking about the C function, but what is used in shell script).
Any way i could do it here vertically? (don't necessarily need the full feature made, just some indication/hint or implementation that work without doing a for-loop/loop).
I'm aware i could just do something along the line of:
printf '%s\n' {1..10}
But I'm not sure how to make it work horizontally, without rewriting/writing over the text displayed when a file is opened (contrary to what the status line is doing, which work as a separate text object, from my own understanding).
Nordine Lotfi
(2472 rep)
Nov 1, 2020, 03:09 PM
• Last activity: Nov 1, 2020, 03:28 PM
-1
votes
1
answers
77
views
Count occurrences with a BEGIN/END statement
I have a list of numbers: ```none 2 1 3 2 2 2 1 ``` First I had a filelog. I extracted all the ID. Now, how do I count the occurrences of each number and display it like this? (the first one is the number, the second number is the occurrence of the number) ```none 2,4 1,2 3,1 ``` I had maybe an idea...
I have a list of numbers:
2
1
3
2
2
2
1
First I had a filelog. I extracted all the ID. Now, how do I count the occurrences of each number and display it like this?
(the first one is the number, the second number is the occurrence of the number)
2,4
1,2
3,1
I had maybe an idea:
awk -F'|' 'BEGIN{print "count", "lineNum"}{print gsub(/t/,"") "\t" NR}' file
log
(1 rep)
Oct 28, 2020, 09:33 PM
• Last activity: Oct 28, 2020, 10:34 PM
17
votes
3
answers
20882
views
Are the major, minor number unique
Are the `major, minor` number Unique? Do we have any citations and reference to it? NAME MAJ:MIN RM SIZE RO MOUNTPOINT sda 8:0 0 465.8G 0 ├─sda1 8:1 0 298.2M 0 ├─sda2 8:2 0 3G 0 ├─sda3 8:3 0 458.7G 0 / ├─sda4 8:4 0 1K 0 └─sda5 8:5 0 3.8G 0 sr0 11:0 1 1024M 0
Are the
major, minor
number Unique?
Do we have any citations and reference to it?
NAME MAJ:MIN RM SIZE RO MOUNTPOINT
sda 8:0 0 465.8G 0
├─sda1 8:1 0 298.2M 0
├─sda2 8:2 0 3G 0
├─sda3 8:3 0 458.7G 0 /
├─sda4 8:4 0 1K 0
└─sda5 8:5 0 3.8G 0
sr0 11:0 1 1024M 0
Deepak Ingole
(517 rep)
Apr 11, 2014, 08:30 AM
• Last activity: Sep 23, 2020, 10:14 PM
0
votes
2
answers
79
views
Placing matching occurrence number to the left side of the occurrence itself
I have a file with multiple occurrences of the expression ".mp3". I want the first occurrence to become "1.mp3", the second occurrence to become "2.mp3", and so on. It would be something like awk '/ mp3 / NR' file My file: ``` line 1 wget .mp3 url line 2 wget .mp3 .... ``` I haven't got any results
I have a file with multiple occurrences of the expression ".mp3". I want the first occurrence to become "1.mp3", the second occurrence to become "2.mp3", and so on.
It would be something like awk '/ mp3 / NR' file
My file:
line 1
wget .mp3 url
line 2
wget .mp3
....
I haven't got any results
7beggars_nnnnm
(109 rep)
Sep 9, 2019, 04:19 AM
• Last activity: Sep 9, 2019, 08:56 AM
-1
votes
1
answers
72
views
Bash: I have a variable in bash script;
I have a variable in bash script dirs= "4"; I want to get this number from another file so I am using a command dirs= sed -n '1p' < test.txt; It gets me the number, I see it in the terminal. But Later in the code, I want to use a loop for dir in dirs.. it does not work because in the script it does...
I have a variable in bash script dirs= "4"; I want to get this number from another file so I am using a command dirs= sed -n '1p' < test.txt; It gets me the number, I see it in the terminal. But Later in the code, I want to use a loop for dir in dirs.. it does not work because in the script it does not understand that dir is number.
d= sed -n '1p' < test.txt
for dirs in $d
do
echo "$dirs"
done
dirs= read $dirs
speeds= sed -n '2p' < test.txt
for speeds in $s
do
echo "$speeds"
done
for dir in $dirs
do
for speed in $speeds
do
echo "speed=$speed dir=$dir"
done
done
Green
(15 rep)
Apr 10, 2019, 03:05 PM
• Last activity: Apr 10, 2019, 03:15 PM
-1
votes
2
answers
114
views
Wish to add numbers to word/url
What i want; as of example- Youtube.com/1 i wish to have an automated script that counts up to a 1000 >URL EXAMPLE: >https://www.youtube.com/1 >https://www.youtube.com/2 Edit: --- [Fetching user title] Seen a post prior of someone posting how to do it by single account >wget -qO- 'http://www.twitter...
What i want;
as of example- Youtube.com/1
i wish to have an automated script that counts up to a 1000
>URL EXAMPLE:
>https://www.youtube.com/1
>https://www.youtube.com/2
Edit: ---
[Fetching user title]
Seen a post prior of someone posting how to do it by single account
>wget -qO- 'http://www.twitter.com/9 ' |
perl -l -0777 -ne 'print $1 if /\s*(.*?)(?: - twitter)?\s*> .txt
Ninth
(1 rep)
Oct 4, 2018, 12:34 PM
• Last activity: Oct 10, 2018, 05:05 PM
Showing page 1 of 20 total questions