Questions tagged [awk]

The AWK utility is a data extraction and reporting tool that uses a data-driven scripting language consisting of a set of actions to be taken against textual data (either in files or data streams) for the purpose of producing formatted reports.

The AWK utility is a data extraction and reporting tool that uses a data-driven scripting language consisting of a set of actions to be taken against textual data (either in files or data streams) for the purpose of producing formatted reports. The language used by awk extensively uses the string datatype, associative arrays (that is, arrays indexed by key strings), and regular expressions.

AWK was created at Bell Labs in the 1970s, and its name is derived from the family names of its authors — Alfred Aho, Peter Weinberger, and Brian Kernighan.

184 questions
-2
votes
1 answer

How to insert text from a file into another in bash

The content in fileA is: Here’s the ip list. ip: 2.2.3.4 ip: 2.2.3.5 ip: 2.2.3.6 ip: 2.2.3.7 The content is fileB is ip: 1.2.3.4 ip: 1.2.3.5 ip: 1.2.3.6 ip: 1.2.3.7 How to use sed command or other commands in a bash script to produce a list…
Purres
  • 239
  • 1
  • 4
  • 18
-3
votes
1 answer

searching file for last matching line, then put 3rd word of this line into a variable

i have a logfile, a script checks this log-file every hour it shall pack the 3rd word of the last matching line into a variable but i didn't manage it to work yet .. logfile: 2018-11-18 22:27:10 1542576430 c2- restarted=true 2018-11-19 00:14:34…
nyma3
  • 1
  • 2
-3
votes
2 answers

linux + solaris + delete all characters in file except numbers and dot char

please advice how to delete all characters in file except numbers and "." Should be implemented by sed or awk or perl ( one line ) or any other idea , so I will add the syntax in my ksh script remark - the solution must be according to the…
yael
  • 2,363
  • 4
  • 28
  • 41
-3
votes
3 answers

How to pass the output of a command as a variable in a bash script?

I'm trying to pass the output of an awk command as a variable in a bash script, but not having much success so any help is appreciated. homedirectory=$(awk /stephen/ /etc/passwd | awk -F/home/ '{print $2}' | awk -F/downloads '{print $1}') echo…
Stephen
  • 191
  • 1
  • 2
  • 7
1 2 3
12
13