Get permissions and concatenate them in one line2019 Community Moderator Electionfind numbers in parentheses and round themhow to concatenate a file with multiple header into oneRead two text files, concatenate each linesed command and formatting one line helpConcatenate multiple fields separately based on one (key) columnGet lines matching a pattern in one file and put them into a second file matching the same patternconcatenate lines based on first char of next linecompare several text files and summarize them to one fileHow to reformat named.conf's zone blocks into single lines?Get one thing from a line and concatenate it with one thing from another line
Is camera lens focus an exact point or a range?
Proof of Lemma: Every nonzero integer can be written as a product of primes
Could the E-bike drivetrain wear down till needing replacement after 400 km?
What is this type of notehead called?
Should I stop contributing to retirement accounts?
How do ground effect vehicles perform turns?
What does this horizontal bar at the first measure mean?
Global amount of publications over time
How can "mimic phobia" be cured or prevented?
On a tidally locked planet, would time be quantized?
Does having a TSA Pre-Check member in your flight reservation increase the chances that everyone gets Pre-Check?
When quoting, must I also copy hyphens used to divide words that continue on the next line?
Why do IPv6 unique local addresses have to have a /48 prefix?
Proving a function is onto where f(x)=|x|.
A Permanent Norse Presence in America
Structured binding on const
Is there a word to describe the feeling of being transfixed out of horror?
Customize circled numbers
Can I use my Chinese passport to enter China after I acquired another citizenship?
Is possible to search in vim history?
Open a doc from terminal, but not by its name
How to color a curve
How much character growth crosses the line into breaking the character
What does the Rambam mean when he says that the planets have souls?
Get permissions and concatenate them in one line
2019 Community Moderator Electionfind numbers in parentheses and round themhow to concatenate a file with multiple header into oneRead two text files, concatenate each linesed command and formatting one line helpConcatenate multiple fields separately based on one (key) columnGet lines matching a pattern in one file and put them into a second file matching the same patternconcatenate lines based on first char of next linecompare several text files and summarize them to one fileHow to reformat named.conf's zone blocks into single lines?Get one thing from a line and concatenate it with one thing from another line
Here is the result of listing the files in a directory.
total 4
-rw-r--r-x 1 y_wc y_wc 6828641 dez 24 18:21 file1
-rw-rw-rw- 1 y_wc y_wc 2051577 dez 24 18:13 file2
-rw-rwxr-x 1 y_wc y_wc 1874334 dez 24 18:14 file3
-rw-rwxrwx 1 y_wc y_wc 2902856 dez 24 18:14 file4
I'd like to concatenate the permissions in one line by the same order by which they appear. Here permissions exclude the file type. The output should berw-r--r-xrw-rw-rw-rw-rwxr-xrw-rwxrwx
I'd like solutions using coreutils and, separately, awk
.
I'm close with the coreutils solution, but I'm unable to get rid of the file type character. Here's what I got
ls -l | tail -n+2 | cut -d" " -f1 | tr -d 'n'
text-processing
New contributor
add a comment |
Here is the result of listing the files in a directory.
total 4
-rw-r--r-x 1 y_wc y_wc 6828641 dez 24 18:21 file1
-rw-rw-rw- 1 y_wc y_wc 2051577 dez 24 18:13 file2
-rw-rwxr-x 1 y_wc y_wc 1874334 dez 24 18:14 file3
-rw-rwxrwx 1 y_wc y_wc 2902856 dez 24 18:14 file4
I'd like to concatenate the permissions in one line by the same order by which they appear. Here permissions exclude the file type. The output should berw-r--r-xrw-rw-rw-rw-rwxr-xrw-rwxrwx
I'd like solutions using coreutils and, separately, awk
.
I'm close with the coreutils solution, but I'm unable to get rid of the file type character. Here's what I got
ls -l | tail -n+2 | cut -d" " -f1 | tr -d 'n'
text-processing
New contributor
add a comment |
Here is the result of listing the files in a directory.
total 4
-rw-r--r-x 1 y_wc y_wc 6828641 dez 24 18:21 file1
-rw-rw-rw- 1 y_wc y_wc 2051577 dez 24 18:13 file2
-rw-rwxr-x 1 y_wc y_wc 1874334 dez 24 18:14 file3
-rw-rwxrwx 1 y_wc y_wc 2902856 dez 24 18:14 file4
I'd like to concatenate the permissions in one line by the same order by which they appear. Here permissions exclude the file type. The output should berw-r--r-xrw-rw-rw-rw-rwxr-xrw-rwxrwx
I'd like solutions using coreutils and, separately, awk
.
I'm close with the coreutils solution, but I'm unable to get rid of the file type character. Here's what I got
ls -l | tail -n+2 | cut -d" " -f1 | tr -d 'n'
text-processing
New contributor
Here is the result of listing the files in a directory.
total 4
-rw-r--r-x 1 y_wc y_wc 6828641 dez 24 18:21 file1
-rw-rw-rw- 1 y_wc y_wc 2051577 dez 24 18:13 file2
-rw-rwxr-x 1 y_wc y_wc 1874334 dez 24 18:14 file3
-rw-rwxrwx 1 y_wc y_wc 2902856 dez 24 18:14 file4
I'd like to concatenate the permissions in one line by the same order by which they appear. Here permissions exclude the file type. The output should berw-r--r-xrw-rw-rw-rw-rwxr-xrw-rwxrwx
I'd like solutions using coreutils and, separately, awk
.
I'm close with the coreutils solution, but I'm unable to get rid of the file type character. Here's what I got
ls -l | tail -n+2 | cut -d" " -f1 | tr -d 'n'
text-processing
text-processing
New contributor
New contributor
New contributor
asked yesterday
y_wcy_wc
1196
1196
New contributor
New contributor
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
ls
has very poor options for formatting . stat
has --printf
option , to format has you want information about files .
a example :
root@linux:~# stat --printf '%An' /etc/passwd /etc
-rw-r--r--
drwxr-xr-x
in tour case because you don't the first character
root@linux:~# stat --printf '%An' file* | cut -c2-11 | tr -d 'n'
Thanks. But this is printing the file type.
– y_wc
yesterday
Thecut
could be justcut -c 2-
.
– Kusalananda
yesterday
add a comment |
The first character can be removed with cut -c 2-
ls -l | tail -n+2 | cut -d" " -f1 | cut -c 2- | tr -d 'n'
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
y_wc is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f508216%2fget-permissions-and-concatenate-them-in-one-line%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
ls
has very poor options for formatting . stat
has --printf
option , to format has you want information about files .
a example :
root@linux:~# stat --printf '%An' /etc/passwd /etc
-rw-r--r--
drwxr-xr-x
in tour case because you don't the first character
root@linux:~# stat --printf '%An' file* | cut -c2-11 | tr -d 'n'
Thanks. But this is printing the file type.
– y_wc
yesterday
Thecut
could be justcut -c 2-
.
– Kusalananda
yesterday
add a comment |
ls
has very poor options for formatting . stat
has --printf
option , to format has you want information about files .
a example :
root@linux:~# stat --printf '%An' /etc/passwd /etc
-rw-r--r--
drwxr-xr-x
in tour case because you don't the first character
root@linux:~# stat --printf '%An' file* | cut -c2-11 | tr -d 'n'
Thanks. But this is printing the file type.
– y_wc
yesterday
Thecut
could be justcut -c 2-
.
– Kusalananda
yesterday
add a comment |
ls
has very poor options for formatting . stat
has --printf
option , to format has you want information about files .
a example :
root@linux:~# stat --printf '%An' /etc/passwd /etc
-rw-r--r--
drwxr-xr-x
in tour case because you don't the first character
root@linux:~# stat --printf '%An' file* | cut -c2-11 | tr -d 'n'
ls
has very poor options for formatting . stat
has --printf
option , to format has you want information about files .
a example :
root@linux:~# stat --printf '%An' /etc/passwd /etc
-rw-r--r--
drwxr-xr-x
in tour case because you don't the first character
root@linux:~# stat --printf '%An' file* | cut -c2-11 | tr -d 'n'
edited yesterday
answered yesterday
EchoMike444EchoMike444
1,0306
1,0306
Thanks. But this is printing the file type.
– y_wc
yesterday
Thecut
could be justcut -c 2-
.
– Kusalananda
yesterday
add a comment |
Thanks. But this is printing the file type.
– y_wc
yesterday
Thecut
could be justcut -c 2-
.
– Kusalananda
yesterday
Thanks. But this is printing the file type.
– y_wc
yesterday
Thanks. But this is printing the file type.
– y_wc
yesterday
The
cut
could be just cut -c 2-
.– Kusalananda
yesterday
The
cut
could be just cut -c 2-
.– Kusalananda
yesterday
add a comment |
The first character can be removed with cut -c 2-
ls -l | tail -n+2 | cut -d" " -f1 | cut -c 2- | tr -d 'n'
add a comment |
The first character can be removed with cut -c 2-
ls -l | tail -n+2 | cut -d" " -f1 | cut -c 2- | tr -d 'n'
add a comment |
The first character can be removed with cut -c 2-
ls -l | tail -n+2 | cut -d" " -f1 | cut -c 2- | tr -d 'n'
The first character can be removed with cut -c 2-
ls -l | tail -n+2 | cut -d" " -f1 | cut -c 2- | tr -d 'n'
answered yesterday
MarvinMarvin
17616
17616
add a comment |
add a comment |
y_wc is a new contributor. Be nice, and check out our Code of Conduct.
y_wc is a new contributor. Be nice, and check out our Code of Conduct.
y_wc is a new contributor. Be nice, and check out our Code of Conduct.
y_wc is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f508216%2fget-permissions-and-concatenate-them-in-one-line%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown