10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Hi Community!
Following on from this code in another thread:
#!/bin/bash
file_string=`/bin/cat date.txt | /usr/bin/awk '{print $5,$4,$7,$6,$8}'`
file_date=`/bin/date -d "$file_string"`
file_epoch=`/bin/date -d "$file_string" +%s`
now_epoch=`/bin/date +%s`
if
then
#let... (2 Replies)
Discussion started by: Greenage
2 Replies
2. Linux
Hi,
My question is how to calculate the quarter end date according to the current date in shell script? (2 Replies)
Discussion started by: Divya_1234
2 Replies
3. UNIX for Beginners Questions & Answers
I am trying to work on a script where it is a *(star) delimited file has a multiple lines starts with RTG and 3rd column=TD8 I want to substring the date part and
I want to replace with currentdate minus 15 days. Here is an example. iam using AIX server
$ cat temp.txt
RTG*888*TD8*20180201~... (1 Reply)
Discussion started by: Shankar455
1 Replies
4. Shell Programming and Scripting
Hi All,
I am new in scripting and working in a project where we have RSyslog servers over CentOS v7 and more than 200 network devices are sending logs to each RSyslog servers. For each network devices individual folders create on the name of the each network devices IP addresses.The main... (7 Replies)
Discussion started by: Pinaki
7 Replies
5. Shell Programming and Scripting
hi all,
How to compare two files whether they are same are not...? like i had my input files as 20141201_file.txt and 20141130_file2.txt
how to compare the above files based on date .. like todays file and yesterdays file...? (4 Replies)
Discussion started by: hemanthsaikumar
4 Replies
6. Shell Programming and Scripting
Hi Guys,
I need to write a script to compare the count of two csv files each having 5 columns.
Everyday a csv file is recived.
Now we need to compare the count of todays csv file with yesterday's csv file and if the total count of records is same in todays csv file and yesterday csv file out... (3 Replies)
Discussion started by: Vivekit82
3 Replies
7. Shell Programming and Scripting
Hi,
I want to subtract 'n' days from the current timestamp in a k shell script. Is there any inbuilt function to do it
or any workaround solution to get the date. And I want the output to be in YYYY:MM:DD HH:MM:SS format. Please help.
Thanks in advance. (4 Replies)
Discussion started by: Suryaaravindh
4 Replies
8. Shell Programming and Scripting
consider this as a csv file.
H,0002,0002,20100218,17.25,P,barani
D,1,2,3,4,5,6,7,8,9,10,11
D,1,2,3,4,5,6,7,8,9,10,11
D,1,2,3,4,5,6,7,8,9,10,11
D,1,2,3,4,5,6,7,8,9,10,11
D,1,2,3,4,5,6,7,8,9,10,11
T,5
N
i want to read the csv file and count the number of rows that start with D and... (11 Replies)
Discussion started by: barani75
11 Replies
9. Shell Programming and Scripting
Hi folks,
I need to write a script that should activate a process according to the current hour.
The process should be activatet only if the hour is between midnight (00:00) and 07:00.
How should I create the condition?
Thanks in advance,
Nir (2 Replies)
Discussion started by: nir_s
2 Replies
10. UNIX for Dummies Questions & Answers
I have few webservers logs like access.log. which would be growing everyday.
what i do everyday is, take the backup of access.log as access.log_(currentdate) and nullify the access.log.
So thought of writing a script... but stuck up in middle.
My requirement: to take the backup and nullify... (6 Replies)
Discussion started by: logic0
6 Replies
fstrcmp(1) General Commands Manual fstrcmp(1)
NAME
fstrcmp - fuzzy comparison of strings
SYNOPSIS
fstrcmp [ -p ] first-string second-string
fstrcmp -w first-string second-string
fstrcmp -a first-file second-file
fstrcmp -s needle haystack...
fstrcmp --version
DESCRIPTION
The fstrcmp command is used to make fuzzy comparisons between strings. The "edit distance" between the strings is printed, with 0.0 mean-
ing the strings are utterly un-alike, and 1.0 meaning the strings are identical.
You may need to quote the string to insulate them from the shell.
OPTIONS
The fstrcmp command understands the following options:
-a
--files-as-bytes
This option is used to compare two files as arrays of bytes. See fmemcmp(3) for more information.
-p
--pair This option is used to compare two strings as arrays of bytes. This is the default. See fstrcmp(3) for more information.
-s
--select
This option is used to select the closest needle from the provided haystack alternatives. The most similar (single) choice is
printed. If none are particularly similar, nothing is printed. See fstrcmp(3) for more information. See below for example.
-V
--version
This option may be used to print the version of the fstrcmp command, and then exit.
-w
--wide-pair
This option is used to compare two multi-byte character strings. See fstrcoll(3) for more information.
EXIT STATUS
The fstrcmp command exits with status 1 on any error. The fstrcmp command only exits with status 0 if there are no errors.
EXAMPLE
The fstrcmp --select option may be used in a shell script to improve error messages.
case "$action" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "$0: action "$action" unknown" 1>&2
guess=`fstrcmp --select "$action" stop start restart`
if [ "$guess" ]
then
echo "$0: did you mean "$guess" instead?" 1>&2
fi
exit 1
;;
esac
Thus, the error message frequently suggests the correct action in the face of simple finger problems on the command line.
SEE ALSO
fstrcmp(3)
fuzzy comparison of strings
fstrcoll(3)
fuzzy comparison of two multi-byte character strings
fstrcmpi(3)
fuzzy comparison of strings, integer variation
COPYRIGHT
fstrcmp version 0.4
Copyright (C) 2009 Peter Miller
Peter Miller <pmiller@opensource.org.au>
The comparison code is derived from the fuzzy comparison functions in GNU Gettext 0.17. The GNU Gettext comparison functions were, in
turn, derived from GNU Diff 2.7.
Copyright (C) 1988-2009 Free Software Foundation
fstrcmp(1)