…The challenge in this case was to start with the file…nameemailavg.csv, which is a comma separated file, and produce…an output which is identical except that it is tab separated.…Note that there are three fields on each line.…I can think of several ways to do this.…Here's one.…We'll use the -f to indicate that the input is comma separated.…And then we'll simply print the first field, a tab character, second field, a…tab character, and the third field, which…produces the tab separated output as requested.…
Here's another way to do it.…In the BEGIN statement, we'll set the field separator to a comma.…And the output field separator to a tab.…Then we'll print field one, field two, field…three, using commas to use the output field separator.…Which again, produces the desired result.…Now here's another thing that you might try.…We'll specify the comma for the input.…The tab for the output.…And then just print.…Because we think, while we're reading commas in, we'll put tabs out.…
But this doesn't work.…It produces the same output as the input.…
Author
Released
5/21/2014In this course, award-winning author and teacher David D. Levine shows you how to use AWK to read and write data in a variety of formats, produce reports, and automate repetitive tasks. He reviews the nuts and bolts of the language, such as field separators, pattern matching, variables, operators, expressions, and control structures; functions available for manipulating data; and integration with other programs like Excel.
- Determine what AWK is.
- Recognize how to write an AWK program.
- Determine how to use AWK command-line flags.
- Identify how to specify field and record separators with variables.
- Distinguish how to change a CVS file to a tab-separated one.
- Break down how to work with operators and arrays.
- Discover how to format output.
- Interpret how to string data with functions.
Skill Level Intermediate
Duration
Views
Related Courses
-
Learning Bash Scripting (2013)
with Scott Simpson1h 25m Beginner
-
Introduction
-
Welcome59s
-
-
1. What Is AWK?
-
What is AWK?3m 11s
-
-
2. AWK Command Line Basics
-
Writing an AWK program2m 51s
-
Using AWK command-line flags6m 18s
-
-
3. Understanding Records and Fields
-
4. Understanding Variables and Operators
-
5. A Quick Introduction to Regular Expressions
-
Regular expression basics5m 19s
-
-
6. Using Control Structures
-
Building control structures4m 14s
-
Creating an HTML table4m 45s
-
-
7. Formatting the Output
-
8. Functions and Arrays
-
Manipulating strings7m 28s
-
Using associative arrays4m 55s
-
-
9. Combining AWK with Other Tools
-
Using pipes7m 6s
-
Scripting with AWK4m 56s
-
Challenge: Perform a join1m 13s
-
Solution: Perform a join2m 55s
-
-
Conclusion
-
Goodbye1m 10s
-
- 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.
CancelTake 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.
Share this video
Embed this video
Video: Solution: Change a CSV file to a tab-separated one