This is my Linux script, I want to ask the user from outside what date is needed, then save that date and run the script for that date. now currently this script generate a csv for the current date files, I want to run this for a user request date, can I pass parameters from outside? any help could be
Tag: awk
awk renamed few files and left few to renamed
I am trying to replace part of filenames based on matching string of filename from another file. Filenames are in following format: where digits before first _ represent station code, which I want to replace with its station name from another file named radiosonde.csv. For example : I want change 36872_20190806_00.csv to ALMATY_20190806_00.csv change 38064_20190806_00.csvto KYZYLORDA_20190806_00.csv Data of radiosonde is
Finding Duplicate rows based on a column in Unix File
I have a file of about 1 Million records. I need to extract the records which have different FName and LName for id. Input File The result that I want to see Any AWK or Sed command or script can help? Thanks Answer Using GNU awk for arrays of arrays: or if your input file is sorted by “id” as
awk ‘FNR == 2 {print}’ issue
I have some task on which i need to know the install date of WLS which is located in second row of file called envVars.properties which is located in /opt/weblogic1221/wlserver_12.2.1/installation/install/envVars.properties. I have server which has multiple versions of WL there for I use * in /opt/weblogic*/wlserver*/…. But when I run cat /opt/weblogic*/wlserver*/installation/install/*.properties| awk ‘FNR == 2 {print}’ I get only
How to resize the block of a column
I have a single column of a file having many blocks and the blocks are separated by the > symbol. I want to resize all blocks to the same highest length by appending zero below them. My file is given below: file.txt and my expected output is given below I am trying to write a script, but it fails: Answer
Move all rows in a tsv with a certain date to their own file
I have a TSV file with 4 columns in this format The 4th column is a date string Example : 2020-12-09 12:34:22 I want every row with the same date to go into its own file For example, file 20201209 should have all rows that start with 2020-12-09 in the 4th column file 20201210 should have all rows that start
Display ethernet interface and its corresponding IP address from Linux “ip a s”
I am trying to list all the ethernet device names and its assigned IP address available in the RHEL node using the output of ip addr show command I print all the network interfaces names only with the following: I am trying to get the output in the below format by applying more logic and coding in the above awk
How to speed-up sed that uses Regex on very large single cell BAM file
I have the following simple script that tries to count the tag encoded with “CB:Z” in SAM/BAM file: Typically it needs to process 40 million lines. That codes takes around 1 hour to finish. This line sed ‘s/.*CB:Z:([ACGT]*).*/1/’ is very time consuming. How can I speed it up? The reason I used the Regex is that the “CB” tag column-wise
Rounding of the millisecond part in Linux datetime
So I have the date format like this : 2019-10-19 23:55:42.797 and I want the millisecond part to be round of into the second so the output should look something like this: 2019-10-19 23:55:43 I have tried date -d “2019-10-19 23:55:42.797” “+%Y-%m-%d %H:%M:%S” but it’s giving me output like 2019-10-19 23:55:42 How should I do this in Linux bash shell?
using awk to count the number of occurrences of pattern from another file
I am trying to take a file containing a list and count how many times items in that list occur in a target file. something like: I have coopted the following code to get the values that are present in target.txt: But the output does not include the desired items that are in the liist.txt but not the target.txt I