Sponsored Content
Top Forums Shell Programming and Scripting Problem with gstat and octal value Post 303014879 by apmcd47 on Thursday 22nd of March 2018 12:26:22 PM
Old 03-22-2018
Step back a minute. Is gstat Gnu stat from the OpenCSW packages for Solaris?

Try this convolution instead of the one you were using (original post):

Code:
elif [[ "$file" =~ [A-Z] && $CDATE = "Feb" && $(/opt/csw/bin/gdate +%_m --date="$(/opt/csw/bin/gstat --format=%y "$file")") -eq 02 ]];

This way you get only the file modification time out of gstat (removes the need for both grep and awk); then feed it into gdate which then pops out the month. gdate +%_m also replaces leading zeroes with leading spaces which should get rid of your 08 isn't an octal number problem.

The $(..."$(..."..."...)"...) should look after themselves.

Andrew

PS This is why you should say what OS, etc, you are using.
 

10 More Discussions You Might Find Interesting

1. Programming

octal and strings

hi i have a peculiar problem...i have a number of stirngs separated by a '/0'. it looks somethings like: char test="abk\0jsdhj\01234\0" actually i will be reading this from a file or something... im supposed to change the \0 to a ',' but in C the octal representation starts with a '\'...... (1 Reply)
Discussion started by: strider
1 Replies

2. UNIX for Dummies Questions & Answers

Display permissions in octal format

Hi, Is there any way to display the permissions in octal format rather than "rwxrwxrwx" format. I have a file and i want to see the permissions in octal format. Please help. (11 Replies)
Discussion started by: venkatesht
11 Replies

3. Shell Programming and Scripting

[bash]printf octal instead of decimal

Hello everybody, I would like to understand why the printf function is returning me an octal value with this command : printf %4.4d 0010 returns 0008 printf %4.4d 10 returns 0010 Thanks for help. (3 Replies)
Discussion started by: dolphin06
3 Replies

4. Shell Programming and Scripting

Command to return permissions in octal format

Is there any command that would return the permissions of a file or folder in octal format (e.g. 755, 644, etc.) Thanks (4 Replies)
Discussion started by: pcwiz
4 Replies

5. UNIX for Dummies Questions & Answers

ls switch to view octal permissions??

Is there seriously not an easy way to do this? you really need a script for it? that is ridiculous! Please someone tell me there is an ls switch to view octal permissions instead of rwx i want 777. (1 Reply)
Discussion started by: glev2005
1 Replies

6. Homework & Coursework Questions

Problem with simple octal to decimal code

Hello all I started computer science and C++ programming only 6 weeks ago with no prior knowledge. It's a great language, the only other one apart from English that I hope to speak fluently quite soon. I look forward to participating further on these forums, seeking answers and looking at previous... (3 Replies)
Discussion started by: qf_woodfox
3 Replies

7. UNIX for Dummies Questions & Answers

Deleting octal values

I have some junk values in my files 鵶„‰¼±¤¡ad. am able to find the octal values as below by using od command. 303 251 265 266 204 211 274 261 244 241 141 144 i want to know how to delete the octal this values . (5 Replies)
Discussion started by: vino.paal
5 Replies

8. Shell Programming and Scripting

syntax for IF test or AWK for octal

Using korn shell. I am reading a file line by line. If a record has a carriage return (octal 015) then I append the second record to the first record. Not all records have a carriage return. I have the unix shell script working with grep, but when my file has +100,000 records it runs slow. I would... (3 Replies)
Discussion started by: sboxtops
3 Replies

9. Shell Programming and Scripting

SED on cygwin not working with Hex or Octal

Hi, I have downloaded a web page that I need to cleanup before passing to xmlstarlet. Using UltraEdit's HEX utility part of my download is as follows: 3C 2F 61 3E 0A 09 0A 09 09 3C 2F 61 3E which in ASCII is </a> </a> I need to locate this string and replace it with just... (7 Replies)
Discussion started by: dazhoop
7 Replies

10. What is on Your Mind?

Who remembers the Compuserve octal, numerical email addresses?

As the title says, who does remember them? I still have my ten digit one and is fully active. IIRC it was the then user's account number, and mine came in 'xxxxxx,xxxx' format where the comma had to be replaced by a period. The text mode __browser__ CIS, (Compuserve Information Srevice), was... (0 Replies)
Discussion started by: wisecracker
0 Replies
GSTAT(8)						    BSD System Manager's Manual 						  GSTAT(8)

NAME
gstat -- print statistics about GEOM disks SYNOPSIS
gstat [-abcdop] [-f filter] [-I interval] DESCRIPTION
The gstat utility can be used to monitor I/O transactions of geom(4) devices. The options are as follows: -a Only display providers that are at least 0.1% busy. -b Batch mode. Collect numbers, print and exit. Default if stdout is not a tty. -c Enable display of geom(4) consumers too. The default is to show statistics only for geom(4) producers. -d Enable display of statistics for delete (BIO_DELETE) operations. -f filter A regular expression that can be used to only show statistics for some devices. Only devices with the names matching filter will be displayed. The format of the regular expression is described in re_format(7). -o Enable display of statistics for other operations (BIO_FLUSH). -I interval Refresh the gstat display every interval microseconds. Adding a suffix of s, ms, or us (the default) indicates that the update interval is specified in seconds, milliseconds, or microseconds, respectively. -p Only display physical providers (those with rank of 1). EXIT STATUS
The gstat utility exits 0 on success, and >0 if an error occurs. SEE ALSO
systat(1), geom(4), iostat(8), vmstat(8) HISTORY
A gstat utility appeared in FreeBSD 5.0. BSD
July 3, 2014 BSD
All times are GMT -4. The time now is 08:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy