I have never been much of an AWK fan. In fact I have almost never used it. However, today it did serve me well:
- The problem:
- Add a semi colon (;) at the end of each line of a text file
- The solution:
- cat file.txt | awk '{print $0 ";"}'
- Solution explained:
- awk executes the script repeatedly for each line of the input file
- $0 represents each complete line of the file
- The matching pattern is empty, so the rule executes always, for each line. Thus the print statement adds the required semicolon