11-01-2008
Quote:
Originally Posted by
muruganksk
you know one thing, the below two commands give different results.
As they should.
Quote:
$ td=$(date '+%b %d')
$ echo "$td"
Nov 02
It has two spaces in-between
$ echo $td
Nov 02
It has one space in-between
echo prints its arguments separated by a single space.
If you quote $td, you are giving echo one argument. If you don't quote it, the shell expands the variable and performs word splitting on the result, giving two arguments to echo.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi Guys.
I am very new to UNIX.
I need to get yesterdays and tommorows date given todays date.
Which command and syntax do i use in basic UNIX shell.
Thanks. (2 Replies)
Discussion started by: magikminox
2 Replies
2. Linux
Daily one file will dropped into this directory.
Directory: /opt/app/jt/drop
File name: XXXX_<timestamp>.dat.gz
I need to write a script which checks whether the file is dropped daily or not.
Any idea in the script how can we compare timestamp of the file to today's date?? (3 Replies)
Discussion started by: Rajneel
3 Replies
3. Shell Programming and Scripting
Hello guys - I am new to Unix.
I am trying to understand how to grep a perticular string in todays file?
I am trying this syntax but not getting what I am looking for:
% grep `date '+%d/%b/%Y'`
For instance there are 2 files generated today with same data. I am trying to find them and... (21 Replies)
Discussion started by: DallasT
21 Replies
4. Shell Programming and Scripting
Greetings.
I need to generate a simple report via Bash (Korn?) with this raw data
Test_Version=V2.5.2
Test_Version=V2.6.3
Test_Version=V2.4.7
Test_Version=V2.5.2
Test_Version=V2.5.2
Test_Version=V2.5.1
Test_Version=V2.5.0
Test_Version=V2.3.9
... (3 Replies)
Discussion started by: alan
3 Replies
5. Shell Programming and Scripting
Hi Folks,
I have created a script last month to retrive files thru FTP and cronjob was running fine till yesterday. But the naming convention of the daily file is Filename_<date>.xml
where date is YYYYMMDD. But today i have received file name as Filename_20110232.xml :(
Part of my Perl... (4 Replies)
Discussion started by: Sendhil.Kumaran
4 Replies
6. Shell Programming and Scripting
Hello,
I am quite new to unix/shell and want to write a script using bash which will process the files.
Basically i want to search files having name as "date+hostname+somestring.out"
i am using below variables and then will use them in find command :-
TODAY_DATE=$('date +%d')... (5 Replies)
Discussion started by: apm
5 Replies
7. Shell Programming and Scripting
Hi,
I want to compare today's date(DDMMYYYY) with yesterday(DDMMYYYY) from system date,if (today month = yesterday month) then execute alter query else do nothing.
The above requirement i want in Shell script(KSH)...
Can any one please help me?
Double post, continued here. (0 Replies)
Discussion started by: kumarmsk1331
0 Replies
8. UNIX for Dummies Questions & Answers
Not sure why this is not working. Please advice:
#!/bin/sh
DIR=`date +"%m-%d-%y"`
echo $DIR
] && mkdir $DIR (2 Replies)
Discussion started by: iaav
2 Replies
9. UNIX for Dummies Questions & Answers
I am trying to include a snippet in my script to check if the file created is having today's date.
eg: File name is : ABC.YYYYMMDD-nnn.log
The script should check if 'YYYYMMDD' in the above file name matches with today's date.
Can you please help me in achieving this.
Thanks in advance!! (5 Replies)
Discussion started by: kiran1112
5 Replies
10. 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
LEARN ABOUT OPENDARWIN
zgrep
ZGREP(1) General Commands Manual ZGREP(1)
NAME
zgrep - search possibly compressed files for a regular expression
SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename...
DESCRIPTION
Zgrep is used to invoke the grep on compress'ed or gzip'ed files. All options specified are passed directly to grep. If no file is speci-
fied, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and
fed to grep.
If zgrep is invoked as zegrep or zfgrep then egrep or fgrep is used instead of grep. If the GREP environment variable is set, zgrep uses
it as the grep program to be invoked. For example:
for sh: GREP=fgrep zgrep string files
for csh: (setenv GREP fgrep; zgrep string files)
AUTHOR
Charles Levert (charles@comm.polymtl.ca)
SEE ALSO
grep(1), egrep(1), fgrep(1), zdiff(1), zmore(1), znew(1), zforce(1), gzip(1), gzexe(1)
ZGREP(1)