Skip to content
Advertisement

Tag: awk

pass the date from outside as a parameter

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

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

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?

Advertisement