Skip to main content

All Questions

2 votes
2 answers
516 views

Update any date to the current date in a text file

I have a text file which contains several occurrences of dates. All the dates are written in the format Mon-DD-YYYY. I have to update all these dates in the current date keeping the format Mon-DD-YYYY....
user9952796's user avatar
1 vote
1 answer
61 views

Unix script to process data by comparing it to same key records

I have a problem in which Input file has Effective date and End date records. First 6 fields are the keys (12345A). We need to update End date(18 position) based on effective(8 position) date of the ...
Shubham Sharma's user avatar
8 votes
10 answers
15k views

Convert a date from DD-MM-YYYY to YYYY-MM-DD format in bash LINUX

Scenario: I am fetching a date value from a file into a variable and it is in DD-MM-YYYY format by default. I have to substract this date from system date. Subtraction is giving incorrect result if I ...
MayD's user avatar
  • 133
0 votes
1 answer
182 views

Purge lines in a file based on age in shell script

I wanted to record the slave delay in mysql server every minute,so prepared a simple script. #!/bin/bash echo "`date` : `mysql -uroot -pXXXXXX -e"show slave status\G" | grep -i ...
udhayan dharmalingam's user avatar
-2 votes
1 answer
1k views

Insert today's date at the end of a text file - using bash

I have a text files that is generated through daily running bash script - I want to append a date field into that text file - how can I achieve it ? Name NUM_OF_USERS A------10 B------20 **date-...
manisjos's user avatar
  • 109
1 vote
1 answer
155 views

Calculate difference in numbers and save in colon-separated time format with bash script

I have a tab-separated file, e.g., 0018803 01 1710 2050 002571 0018951 01 1934 2525 003277 0019362 02 2404 2415 002829 0019392 01 2621 2820 001924 0019542 01 ...
Aditya's user avatar
  • 11
0 votes
2 answers
183 views

How to filter lines with the same date in different formats

I have a txt file like this: ./201709.15.txt:88:word word TAG201709152000 word word ./201709.19.txt:3:word TAG201709152000 word word ./201710.10.txt:5:word word TAG201709152000 word word word and I ...
Arianna Angeletti's user avatar
-1 votes
3 answers
127 views

insert current date in a place of empty column (field) of a file

I have a file with four columns delimited by "|" as below 23414|test doc for me|| 32322|test doc for you|2004_12_03| 13454|test doc for all||2010_11_01 I am trying to insert the current system date ...
shrawan's user avatar
2 votes
1 answer
376 views

cut slice of file based on time when lines are written

i have a process running always with logging file could reach up to 5 giga, sometime i have to take slice of this log based on interval of time (usually i used dd). is there any command in linux to ...
Charles nakhel's user avatar
6 votes
2 answers
2k views

Bash-script. Shift seconds

In bash I don't know how to do that. I need to do a bash-script. At stdin I have .srt file of subtitles in this format: num HH:MM:SS,SSS --> HH:MM:SS,SSS text line 1 text line 2 ... HH:MM:SS,SSS ...
Georgy's user avatar
  • 101