I’m writing a script that needs to find an exact match in a file that is compatible with QNX and POSIX compliant Linux more detail: Im trying to find the user of a process so the original command I wrote was which works perfectly in POSIX compliant Linux however, QNX isn’t totally POSIX compliant and grep -w isn’t usable for
Tag: awk
awk merged two files with 2 columns based on string character comparison
I am a beginner and my work starts to become difficult for me. I explain my problem. I have two tables File1 and File2 (reference table). I don’t have any identical column but I have some similarity between &2File1 and &2File2. File1 is from user and we want to standardize everything so I have a lot of different cases. I
Align/pad some content in these strings with regex in javascript
I have these strings: and i want to convert them to this: Want to do it with Regular Expressions in Javascript. NOTE 1: The goal is to align the data in the “fifth, sixth and seven column” from right to left. The fifth column has from 1 to 3 digits. The sixth column always has 1 digit, a dot and
Find the average of multiple columns for each distinct variable in column 1
Hi I have a file with 6 columns and I wish to know the average of three of these (columns 2,3,4) and the sum of the last two (columns 5 and 6) for each unique variable in column one. I have come across code that will get the average for column 2 based on column one but is there anyway
Generate a report using awk
I have /etc/fstab entries on 100 servers and i’m trying to write a awk script to identify following. What i need is, first my awk script need to print the domain name, then it should print tools incorrectly mounted on store and is not valid, but kdump01 mounted correctly on kdump , ops mounted correctly on ops) How can i
How can I delete a specific text in a text file
I have a text file : and I want to delete 192.168.47.1 line I tried but output is : I tried sed ‘s/192.168.47.1//g’ but again output is : I searched on google but but I am not able to find the right one. Answer The problem is that your pattern matches 3 lines in your data. You need to end
Running statistics on multiple lines in bash
I have multiple HTTP headers in one giant file, separated with one empty line. I have approximately 10,000,000 of headers separated with an empty line. If I want to discover trends, like header order, I want to do aggregate headers to a one-liner (how I can aggregate lines ending with an empty line and do that separately for all headers?):
Use awk to match a word, then find the first occurrence of another word
I am trying to find a way to re-search for another matching word after I already had a match. I am specifically trying to get the brightness value of one of my monitors. For example a part of the output of my xrandr –verbose is the following: I want to look for the word connected and then get the first
Join two csv files
csvfile1 csvfile2 expected output I would like to combine the columns longitude,latitude and timestamp of both the files. There are two longitudes and two latitudes in csvfile2. So i want to compare if it matches any one of the longitude-latitude pairs along with the timestamp. And the column name order is also different in both the files. Any help would
How to remove some string with awk/sed or another command in linux?
I want to ask, how I can remove some string with command in linux? and the output: Answer try: Making field separator as | then substituting the starting zeros with NULL of 111th field as per your requirements, mentioning 1 will print the newly edited line(if any zeros were replaced with NULL), setting Output field separator as | and mentioning