课程: Learning Linux Command Line
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Solution: Extract information from a text file - Linux教程
课程: Learning Linux Command Line
Solution: Extract information from a text file
(upbeat music) - [Instructor] Let's take a look at how I solved this challenge. The file that we were provided was an archive, so the first step that I took was to write tar -xvf log.tar.gz. And this created a file called auth.log. As I'm sure you found out, that file's hundreds of lines long. So I wanted to get a sense of what I was looking for. Next, I wrote less auth.log, just to take a look at all the text. And scrolling around, I started seeing invalid user login attempts. For example, this line shows invalid user oracle, another shows invalid user db1inst1, and so on. Scrolling down, I can see user zznode, user ftpuser, and so on. Each of these lines has the string input userauth_request, so I know I can look for that. And on these lines, the username occurs at a specific position. I can count from the left, 1, separator, 2, 3, 4, 5, 6, 7, 8, 9. On each of these lines that say…
内容
-
-
-
-
-
-
The Unix philosophy2 分钟 29 秒
-
(已锁定)
Use pipes to connect commands together2 分钟 41 秒
-
(已锁定)
View text files with cat, head, tail, and less4 分钟 44 秒
-
(已锁定)
Search for text in files and streams with grep4 分钟 30 秒
-
(已锁定)
Manipulate text with awk, sed, and sort6 分钟 50 秒
-
(已锁定)
Edit text with Vim4 分钟 35 秒
-
(已锁定)
Edit text with nano2 分钟 49 秒
-
(已锁定)
Working with tar and zip archives8 分钟 17 秒
-
(已锁定)
Challenge: Create and share a file28 秒
-
(已锁定)
Solution: Create and share a file1 分钟 48 秒
-
(已锁定)
Output redirection5 分钟 11 秒
-
(已锁定)
Exploring environment variables and PATH3 分钟 54 秒
-
(已锁定)
Challenge: Extract information from a text file1 分钟 8 秒
-
(已锁定)
Solution: Extract information from a text file3 分钟 28 秒
-
-
-