LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-16-2016, 12:15 PM   #1
hexle
LQ Newbie
 
Registered: Jun 2016
Posts: 12

Rep: Reputation: Disabled
Again i meet problem


ls -l| egrep '^.*[0-9]{1,}:[0-9]{1,}' | tr -s " " | cut -d " " -f 8 |sed -r 's/^(..)..)/\2:\1/'

ls =list directory contents
-l = use a long listing format
egrep=print lines matching a pattern
'^.*[0-9]{1,}:[0-9]{1,}'=^ start of the line . .* whatever .
[0-9]{1,}one time or more.
just alone the ":"
after [0-9]{1,} again the same
tr =translate
-s = --squeeze-repeats
replace each input sequence of a repeated character that is listed in SET1 with a single
occurrence of that character
" " = empty
cut -d : irefered on previous post
-f =--fields=LIST
select only these fields; also print any line that contains no delimiter character, unless the -s
option is specified
8 = i dont know what here wants
sed=stream editor for filtering and transforming text
-r=--regexp-extended
''s/^(..)..)/\2:\1/'=
First : all this find times 2 numbers : 2numbers from anyline .What it does?
Second:I dont want to tired you there is any software online to make practise too sed,egrep etc?i dont want command from linux .

Last edited by hexle; 06-16-2016 at 12:17 PM.
 
Old 06-16-2016, 12:41 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
As with ALL of your other posts asking the same basic question, split it up!

There is absolutely NO reason you have to run that entire line all at once, every time, and guess at what it's doing.

Run the following, in order, and compare the output at each step to the previous to learn what the addition changed:
Code:
ls -l
ls -l| egrep '^.*[0-9]{1,}:[0-9]{1,}'
ls -l| egrep '^.*[0-9]{1,}:[0-9]{1,}' | tr -s " "
ls -l| egrep '^.*[0-9]{1,}:[0-9]{1,}' | tr -s " " | cut -d " " -f 8
ls -l| egrep '^.*[0-9]{1,}:[0-9]{1,}' | tr -s " " | cut -d " " -f 8 |sed -r 's/^(..)..)/\2:\1/'
 
1 members found this post helpful.
Old 06-16-2016, 12:58 PM   #3
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Posts: 1,622
Blog Entries: 40

Rep: Reputation: Disabled
Just for curiosity, which educational system might be responsible for the programmed breakdown during the process of problem-solution? Looks much like French, almost German.
 
Old 06-16-2016, 01:20 PM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,309
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
Quote:
Originally Posted by hexle View Post
... is any software online to make practise too sed,egrep etc?i dont want command from linux .
The software would be on your computer. If you're stuck on a legacy OS instead, you can download and run a Live distro like Linux Mint. If you run in in the Live mode, it will run from the DVD will leave your hard drive alone. ( There used to be some sites offering BSD-based free shell accounts which would give you basic POSIX commands, but not the GNU ones used in the various Linux distros. I don't know of any for GNU/Linux but there might be. )

If you're looking at "sed" and "grep" then some background information would be regular expression pattern matching. Try these two sites for that:

http://www.grymoire.com/Unix/Regular.html
http://www.regular-expressions.info/quickstart.html

From there, "grep" is the simpler tool and you should look at it before "sed"

http://www.cyberciti.biz/faq/grep-regular-expressions/

For what it's worth, "egrep" is just a shortcut for plain old "grep" plus the -E option.

Last, look at "sed", but keep in mind that it is complex enough to have half a thick book dedicated to it alone. So you won't be able to get it all at once, but if you read, you will be able to pick up the basic enough to be able to use it.

https://www.digitalocean.com/communi...-text-in-linux
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
hello all, nice to meet ya, problem with dual boot beed1216 Ubuntu 6 04-03-2011 08:00 AM
when I install fontconfig,I meet some problem,pls help me liulangstar Linux - Software 1 05-29-2008 08:24 PM
when i use ifc 8.0 ,i meet the following problem ztdep Programming 1 07-22-2005 06:07 PM
how to set path? here a meet the problem with ns2 installation cain_eve Linux - Newbie 12 12-16-2004 05:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration