Questions tagged [AWK] (43)

4
answers

Is there a correct way to handle the texts to Cyrillic through awk?

There are two files: country.csv and president.csv country.csv has two columns: 1)the name of the country; 2) the Population president.csv is also two columns: 1)the name of the country; 2)the Name of its President The separator used is the semicolon. Need to get a third file (or append column to the first - does not matter...
Hillard89 asked March 30th 20 at 01:04
2
answers

How to remove a template from all files?

Good afternoon. There are about 1000 almost identical html files. I need to remove from each a certain piece of text and tags. I carved it by hand from one file and saved as remove.txt. How do I use this file as a template and cut it from the rest of the files? Important point: a piece that should be cut, does not begin on ...
Jayden asked March 24th 20 at 13:46
0
answer

Awk/sed multi-line search like?

Hello. The task is the following. There is a system that generates the ip of the attacker on the basis of which it is necessary to close the connection by using pfctl -k id-k id/creatorid. pfctl -ss-vv displays all communication with the necessary data (if udp, then it's 3rd string if tcp, then 4th). The question is how to ...
jennifer_Goyette asked March 23rd 20 at 20:00
1
answer

As in awk, the resulting date from a string compare and print the line?

so just get the date, you need to compare it with echo '12.23.55.11 - - [24/May/2019:08:51:35 +0300] "GET /site/play?cam=1105 HTTP/1.1"' | sed -e 's/\// /' -e 's/\// /' -e '0,/:/s// /' -e '0,/\ +..../s///' -e 's/]/] - /' -e 's/\]//' -e 's/\[//' | awk -F '-' '{print $3}' you want to awk the converted date into a unix timesta...
Berta_Smith96 asked March 21st 20 at 13:08
3
answers

How to parse the file?

Good day! There's a text file with the log bind, you need to clean it from debris Looks like this: 16-May-2019 12:24:46.733 192.168.60.223#49429 top-fwz1.mail.ru I would like to bring in the following form: 16-May-2019 12:24 192.168.60.223 top-fwz1.mail.ru Help with writing a regular expression...
karolann.Brekke asked March 21st 20 at 12:01
2
answers

Portable analogue re.search from Python?

Need multistroke variable (which was the output of the command) to write to a new variable only the value - any IP.OUT=$(ping -c 2 192.168.1.1)PING gw (192.168.1.1) 56(84) bytes of data. 64 bytes from gw (192.168.1.1): icmp_seq=1 ttl=64 time=0.156 ms 64 bytes from gw (192.168.1.1): icmp_seq=2 ttl=64 time=0.143 msVAR=??
ebon asked March 19th 20 at 10:19
2
answers

Use GNU awk?

Good day, the task is to clear the cache of redisclosure, but I can not understand why outlet awk doesn't behave as I expect. Here's the output of my team without the use of awk utility:user@srv:~$ docker run-i --rm --net host redis sh-c "redis-cli -h 192.168.100.79 -p 7000 cluster nodes | grep master" 08a7ff2732079bc7b1137...
lauren.Lars asked March 18th 20 at 22:26
1
answer

How to cut a substring from a string with sed | awk?

Asking for help from connoisseurs of regular expressions. Four hours of Google left me in the same place where it was before. There is a long string retrieved from curl, I need this part: ...,"load":{"map":["load_id","add_time","marks","available","external"],"data":[["77458","1552767081","11.57","298","0"],... want to crea...
Nikita52 asked March 18th 20 at 21:36
2
answers

How to pull strings without brackets?

There is a log file with the contents of the lines about like this: 4 Feb 17:00:00 Avtobaza [Platform, Chassis] 5 Feb 18:00:00 Avtobaza [Platform, Chassis] February 4 19:00:00 Depot The Direction Of The ShopHow to display only the first and second rows with a third in the form: February 4 Chassis Platform ?
Chance_Spenc asked March 17th 20 at 08:52
4
answers

If Awk print 0 if not found value?

How to force the awk output to 0 if it is not found the values in the file ?cat /countCodes | awk ' /'$1'/ {print $1} ' The searching for the file742401 200 404 9553 8594 304 8490 301 403 499 311 302 10 500 7 408 4 503 3 400 3206 access_postdata.log Looking for script code such as 500, and outputs the value 10
willow_Wolff6 asked March 15th 20 at 23:39