All Questions
6,326
questions
5
votes
7
answers
264
views
gawk hangs when using a regex for RS combined with reading a continuous stream from stdin
I'm streaming data using netcat and piping the output to gawk. Here is an example byte sequence that gawk will receive:
=AAAA;=BBBB;;CCCC==DDDD;
The data includes nearly any arbitrary characters, but ...
1
vote
4
answers
93
views
linux extraction for log output not grouping correctly
I have a text file in which command output is copied. I need to parse the text files in separate columns.
I have the below data in a text file port.txt
NAME---SERIALNUMBER------FREE_PORTS
tx1 ...
0
votes
5
answers
114
views
Extract the logs that are logged within 2 timestamps
I am in a situation where I wrote a script to extract the lines within the specified time frame from a log file. This script works fine until I found that it is only printing the lines which has the ...
-5
votes
1
answer
44
views
AWK command to print names of files an hour old [closed]
I want to print the file names that start with file from a given directory that are at least 1 hour old using AWK, the way find /tmp/test/ -mmin +60 does.
Please help me out with the awk command.
1
vote
4
answers
100
views
AWK command to process output from a script
I have a shell script (zsh) that outputs this (set of database count results) with some regular text dispersed throughout:
Regular lines of output that should be ignored.
+-----------------------------...
-4
votes
3
answers
94
views
linux command to coalesce repeated entries in output [closed]
I want to transform this:
dir1 file01
dir1 file02
dir1 file03
dir2 file04
dir2 file05
dir3 file06
dir4 file07
dir4 file08
dir4 file09
dir4 file10
Into the following:
dir1 file01 file02 file03
dir2 ...
-1
votes
3
answers
77
views
Optimise text file statistics calculation by combination of grep, awk, cut
My goal is to calculate statistics from the file that contains the following lines:
2024-05-08 11:02:58,731 INFO o.a.j.a.J.Some check: Closest Day: Wed, New quantity for [email protected] is: 1
...
-1
votes
2
answers
49
views
Need to Update the data of a ASOF_DATE column in a CSV file using shell script
I am trying to update the existing CSV file using shell script. There is a column called ASOF_DATE where am trying to replace the value of it with the current date. The shell script I am using is not ...
1
vote
3
answers
78
views
rearranging with same timestamp using awk
I have a couple of files.
cat << EOF > file1.txt
20190130150000 #timestamp-1
56 39
P A
S-4 B 4. E F ...
1
vote
3
answers
158
views
Get the count of unique words in a file using grep and wc
need command to find the count of unique words in a file using grep
Tried using grep along with uniq and sort but need to find a way to use only grep and wc commands.these are the two ways in which am ...
1
vote
2
answers
80
views
How to change the format of 1st and 5th date column from 28-MAR-2024 to 03/28/2024
Example Input File
AsofDate,Portfolio,Shock,CUSIP,DATE,BALANCE,INTEREST,SCHED_PRIN,UNSCHED_PRIN,LOSS
28-MAR-2024,INV,DN50,28623RAE8,22-APR-2024,25000000,447380,0,0,0
28-MAR-2024,INV,DN50,28623RAE8,22-...
-2
votes
7
answers
101
views
Copy data of a line in front of the data in the next line
Have data like
start {data}
target {ABC}
start {data2}
target {DEF}
target {GHI}
start {data3}
target {JKL}
....
I wish to move the {data} or {data2} which are after the keyword 'start' to their next ...
0
votes
2
answers
86
views
How to extract just the open port numbers from nmap [closed]
Right now my aim is to scan a single IP and get only the open ports printed in a single line separated by commas.
The code below does that but it injects % at the end.
The goal is to extract port ...
1
vote
1
answer
65
views
can't get *only* desired output from awk command
I'm trying to parse a file using awk to return an array of 4 arguments in an applescript, but am not getting the desired result.
Here's the awk command:
awk -F '%' '{if ($1=="Actions") print ...
-2
votes
1
answer
58
views
Write shell command to find long if statements within a directory of php files [closed]
I have a nested directory of files in php, some of them may have if and else conditions within them
if (condition) {
// ~100 lines of code
}
I want to quickly find those [files/start of if or else ...