Sponsored Content
Top Forums Shell Programming and Scripting modify ls -l (long listing format output) strictly using SED only straightforward goalhard 4 me doh Post 302655109 by wolf@=NK on Tuesday 12th of June 2012 08:47:54 PM
Old 06-12-2012
Data modify ls -l (long listing format output) strictly using SED only straightforward goalhard 4 me doh

Below is a sample out of ls -l which I would like to rearrange or modify by field numbers for example I successfully managed to disect using simple paragraph however for ls -l I can't divide the rows or fields by field number.

Successful modification by fields using SED sample:
Code:
[localuser@localhost ~]$ sed -e 's/^\(.*\) \(.*\) \(.*\) \(.*\) \(.*\)/1stString (\1) 2ndWord (\2) 3rdWord (\3) 4thWord (\4) 5thWord (\5)/' maryhad
1stString (Mary) 2ndWord (had) 3rdWord (a) 4thWord (little) 5thWord (lamb.)
And everywhere that Mary
1stString (went, the lamb) 2ndWord (was) 3rdWord (sure) 4thWord (to) 5thWord (go.)
Mary was not Mary'd

#Beta Script not functioning like the one above: not dividing the strings as I intended:Smilie
Code:
[localuser@localhost ~]$ head -3 tabc.txt | sed -e 's/^\(.*\) \(.*\) \(.*\) \(.*\) \(.*\)/1stString (\1) 2ndWord (\2) 3rdWord (\3) 4thWord (\4) 5thWord (\5)/'
)stString (-rwx------- 1 alice   staff     1586) 2ndWord () 3rdWord (2010-11-05) 4thWord (02:27) 5thWord (request-key.conf
)stString (-rwx------- 1 ted   staff     126) 2ndWord () 3rdWord (2011-04-29) 4thWord (13:54) 5thWord (cvs-pserver.conf
)stString (-rwx------- 1 carol   staff     644) 2ndWord () 3rdWord (2011-03-06) 4thWord (21:58) 5thWord (ts.conf

straightforward goal/intent:

separate long listing format fields output of ls using SED only please.

Thank you and welcome for suggestions
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

long listing of files up to a given date

Hi I would like to a long list of files up to a given date. I've tried: ls -al > filelist but this command gives me all the files. I've also have tried the find command: find . -mtime -10 -type f -print > filelist This gives me information on active file within the past 10 days and... (2 Replies)
Discussion started by: rlh
2 Replies

2. Shell Programming and Scripting

ls -l output with long iso format

Hello everbody, I've a list of logfiles (transfer1.log, transfer2.log, ... transfer168.log.) Each of these was created at the end of the actual month and I've to write a script to calculate the utilisation ratio of the actual month of the system. I don't want to scan every logfile, so I've to... (1 Reply)
Discussion started by: rofflox
1 Replies

3. Shell Programming and Scripting

grep/matching help with long listing of directories

How do I get this to work? cat somefile | grep "-rw-r--r-- 1 root wheel 287 Sep 10 15:12 shells~" This is the the desired output -rw-r--r-- 1 root wheel 287 Sep 10 15:12 shells~ I basically want an exact match of the line I am grepping for, the special characters and... (5 Replies)
Discussion started by: streetfighter2
5 Replies

4. Shell Programming and Scripting

sed and Output line too long

hello i try this command in console mode sed -e :a -e '/$/N; s/\(\)\n/\1 /; ta' test.txt > result.txt i have in the output screen "Output line too long" for multiples lines can you please tell me how can i retrieve those long lines during the execution ? Another thing very... (5 Replies)
Discussion started by: ade05fr
5 Replies

5. Solaris

Listing the long groupnames

Hello, When listing the file systems (using ls -ltr) , if the group names are longer the group name is getting truncated. Can someone help with the script which would display the truncated group name? I appreciate if someone could help in this regard. (1 Reply)
Discussion started by: mike12
1 Replies

6. UNIX for Dummies Questions & Answers

shell script for long listing of groupnames

Hello, When listing the file systems (using ls -ltr) , if the group names are longer the group name is getting truncated. Can someone help with the script which would display the truncated group name? I appreciate if someone could help in this regard. (3 Replies)
Discussion started by: mike12
3 Replies

7. Shell Programming and Scripting

Modify a perl line to parse out and output to another format

Hey there... I am looking for a way to take the below contents ( small excerpt) of this file called PTR.csv ptrrecord,0000002e0cc0.homeoffice.anfcorp.com,,10.11.191.62,,,False,62.191.11.10.in-addr.arpa,,302400,default... (6 Replies)
Discussion started by: richsark
6 Replies

8. Shell Programming and Scripting

Format output sed

For each token in this file: Al+nHr Al+ErAqy syAsy lA TA}fy Al+ArbEA' $wAl I hope to get this: AlnHr Al+nHr AlErAqy Al+ErAqy syAsy syAsy lA lA TA}fy TA}fy AlArbEA' Al+ArbEA' $wAl $wAl So I want have this format in each line: <token with no +><space><original token> Is... (1 Reply)
Discussion started by: Viernes
1 Replies

9. Solaris

Grant unprivileged user rights to see the output of echo|format but not modify disks

anyone have any idea how do to this with auth_attr? I suspect if I grant him solaris.device.:RO::Device Allocation::help=DevAllocHeader.html that will work but I'm unsure. Just looking for a second opinion. (10 Replies)
Discussion started by: os2mac
10 Replies

10. Shell Programming and Scripting

Script to generate HTML output format listing like orasnap

Hi, Is there any UNIX scripts out there that generates a listing output of some sort similar to OraSnap At the moment, I have a script that I run on multiple servers that has multiple databases and just querying the database sizes of those databases. It generates a text files that contains... (0 Replies)
Discussion started by: newbie_01
0 Replies
Locale::Po4a::Text(3)					User Contributed Perl Documentation				     Locale::Po4a::Text(3)

NAME
Locale::Po4a::Text - convert text documents from/to PO files DESCRIPTION
The po4a (PO for anything) project goal is to ease translations (and more interestingly, the maintenance of translations) using gettext tools on areas where they were not expected like documentation. Locale::Po4a::Text is a module to help the translation of text documents into other [human] languages. Paragraphs are split on empty lines (or lines containing only spaces or tabulations). If a paragraph contains a line starting by a space (or tabulation), this paragraph won't be rewrapped. OPTIONS ACCEPTED BY THIS MODULE
These are this module's particular options: nobullets Deactivate detection of bullets. By default, when a bullet is detected, the bullet paragraph is not considered as a verbatim paragraph (with the no-wrap flag in the PO file), but the module rewraps this paragraph in the generated PO file and in the translation. tabs=mode Specify how tabulations shall be handled. The mode can be any of: split Lines with tabulations introduce breaks in the current paragraph. verbatim Paragraph containing tabulations will not be re-wrapped. By default, tabulations are considered as spaces. breaks=regex A regular expression matching lines which introduce breaks. The regular expression will be anchored so that the whole line must match. debianchangelog Handle the header and footer of released versions, which only contain non translatable informations. fortunes Handle the fortunes format, which separate fortunes with a line which consists in '%' or '%%', and use '%%' as the beginning of a comment. markdown Handle some special markup in Markdown-formatted texts. asciidoc Handle documents in the AsciiDoc format. control[=taglist] Handle control files. A comma-separated list of tags to be translated can be provided. STATUS OF THIS MODULE
Tested successfully on simple text files and NEWS.Debian files. AUTHORS
Nicolas Francois <nicolas.francois@centraliens.net> COPYRIGHT AND LICENSE
Copyright 2005-2008 by Nicolas FRANCOIS <nicolas.francois@centraliens.net>. This program is free software; you may redistribute it and/or modify it under the terms of GPL (see the COPYING file). perl v5.14.2 2012-05-17 Locale::Po4a::Text(3)
All times are GMT -4. The time now is 05:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy