Join Scott Simpson for an in-depth discussion in this video Solution: Extract information from a text file, part of Learn the Linux Command Line: The Basics.
- [Voiceover] So 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 that 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 cat auth.log just to take a look…at all the text.…And scrolling around I started seeing…invalid user login attempts.…Here for media and further up for other names.…
Like deploy, demo, SVH and so forth.…Each of these lines has this 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.…One, separator, two, three, four,…five, six, seven, eight, nine.…
On each of these lines that say…input_userauth_request it's the ninth item.…So, I'll clear the screen and let's…start writing out the command that I used…to solve the problem.…First I wrote cat auth.log and that gets…the text from the file into my stream.…
This course will establish the foundation for more advanced Linux topics. Find other Linux training courses here.
- What is the Linux command line?
- Writing Linux commands at the prompt
- Finding help for Linux commands
- Editing files and folders
- Configuring user roles and file permissions
- Using pipes to connect commands
- Peeking at files
- Searching and editing text
- Finding disk and system information
- Installing and updating software
Skill Level Beginner
Up and Running with CentOS Linuxwith Scott Simpson1h 32m Beginner
Up and Running with Bash Scriptingwith Scott Simpson1h 25m Beginner
1. Command-Line Basics
2. Files, Folders, and Permissions
3. Common Command-Line Tasks and Tools
4. A Peek at Some More Advanced Topics
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.