Sponsored Content
Top Forums Shell Programming and Scripting script to find filenames with latest version and for all seq. numbers in a day Post 302393159 by Karpak on Monday 8th of February 2010 04:08:48 AM
Old 02-08-2010
Try this.

Code:
#!/usr/bin/ksh
pseq=""
pver=""
phub=""
pfed=""
pdat=""
cat a.txt | grep `date  '+_%d%m%Y_'` | sort -t'_' +2 +3 +4 > out.txt
while IFS="_" read hub feed tdate seq ver ; do
  if [[ "$seq" != "$pseq" ]]
  then
     if [[ "$pseq" == "" ]]
     then
        pseq=$seq
        pver=$ver
        phub=$hub
        pdat=$tdate
        pfed=$feed
     else
        echo "${hub}_${feed}_${tdate}_${pseq}_${pver}"
        pseq=$seq
        pver=$ver
        phub=$hub
        pdat=$tdate
        pfed=$feed
     fi
  else
    if [[ "$pver" < "$ver" ]]
    then
      pver=$ver
    fi
  fi
done < out.txt > out
echo "${phub}_${pfed}_${pdat}_${pseq}_${pver}" >> out
rm -f out.txt


Last edited by Karpak; 02-08-2010 at 05:15 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

What is the latest version of Unix?

I want to buy it (2 Replies)
Discussion started by: LANSTARR.COM
2 Replies

2. Shell Programming and Scripting

Write a shell script to find whether the first day of the month is a working day

Hi , I am relatively new to unix... Can u pls help me out to find out if the first day of the month is a working day ie from (Monday to Friday)...using Date and If clause in Korn shell.. This is very urgent. Thanks for ur help... (7 Replies)
Discussion started by: phani
7 Replies

3. Shell Programming and Scripting

script to find latest executable in particular directory and start that particular ex

i have a directory in which there are executable files and these files are added at runtime. now i need a shell script which will be called at a certain interval. this shell script should find the latest executable file in that directory and start that executable. care should be taken that once the... (6 Replies)
Discussion started by: kvineeth
6 Replies

4. Shell Programming and Scripting

shell script to find latest date and time of the files

Hi everyone, Please help:) I have a list of 1000 different files which comes daily to the directory.Some of the files are not coming to the directory now. I need to write a shell script to find the latest date and time of the files they came to the directory. The files should be unique.... (1 Reply)
Discussion started by: karthicss
1 Replies

5. Shell Programming and Scripting

Script to find previous month last day minus one day timestamp

Hi All, I need to find the previous month last day minus one day, using shell script. Can you guys help me to do this. My Requirment is as below: Input for me will be 2000909(YYYYMM) I need the previous months last day minus 1 day timestamp. That is i need 2000908 months last day minus ... (3 Replies)
Discussion started by: girish.raos
3 Replies

6. Shell Programming and Scripting

Find out the day in Bash Shell script

Hello All, I need a bash shell script to find out a day from the date.For example we give the date(20100227/YYYYMMDD) then we get the day 'Saturday'. Thanks in advance, Satheesh (5 Replies)
Discussion started by: satheesh4093
5 Replies

7. Fedora

Script to find out first day of our calender

I try to find the first day of our calender. So I used this script ... echo -n "The week of the date 01jan0001 : " echo -n `date -d 00010101 +%A` echo But its shows error bash-3.1$ sh first_day.shThe week of the date 01jan0001 : date: invalid date `00010101' (3 Replies)
Discussion started by: krishnampkkm
3 Replies

8. Shell Programming and Scripting

Converting filenames from julian day to yyyy-mm-dd and retrieving weekly mean values

Hi, I need help to convert the filenames of my 9-year daily files (1999-2007) from a julian day to yyyy-mm-dd format. my original files are patterned likes the ones below. 1999001.txt 1999002.txt 1999003.txt 1999004.txt ... 1999365.txt desired output: 19990101.txt 19990102.txt... (3 Replies)
Discussion started by: ida1215
3 Replies

9. Shell Programming and Scripting

How to find the date of previous day in shell script?

Hi Experts, i am using the below code get the date of previous day. #!/usr/bin/ksh datestamp=`date '+%Y%m%d'` yest=$((datestamp -1)) echo $yest When i execute the code i am getting output as: 20130715 What i am trying here is, based on the date passed i am fetching previus day's... (0 Replies)
Discussion started by: learner24
0 Replies

10. Shell Programming and Scripting

awk command to find seq lines

I have a below file FILE.cfg JAN_01 VAR1=4 VAR2=SUM VAR3=PRIVATE JAN_10 VAR1=44 VAR2=GUN VAR3=NATUR JAN_20 VAR1=3 VAR2=TQN VAR3=COMMA code: (JAN_10 is argument passed from script) (6 Replies)
Discussion started by: Roozo
6 Replies
hubd(7D)																  hubd(7D)

NAME
hubd - USB hub driver SYNOPSIS
hub@unit-address The hubd is a USBA (Solaris USB Architecture) compliant client driver that supports USB hubs conforming to the Universal Serial Bus Speci- fication 2.0. The hubd driver supports bus-powered and self-powered hubs. The driver supports hubs with individual port power, ganged power and no power switching. When a device is attached to a hub port, the hubd driver enumerates the device by determining its type and assigning an address to it. For multi-configuration devices, hubd sets the preferred configuration (refer to cfgadm_usb(1M) to select a configuration). The hubd driver attaches a driver to the device if one is available for the default or selected configuration. When the device is disconnected from the hub port, the hubd driver offlines any driver instance attached to the device. /kernel/drv/hubd 32- bit ELF kernel module /kernel/drv/amd64/hubd 64- bit ELF kernel module /kernel/drv/sparcv9/hubd 64-bit SPARC ELF kernel module See attributes(5) for a description of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Architecture |SPARC, , PCI-based systems | +-----------------------------+-----------------------------+ |Availability |SUNWusb | +-----------------------------+-----------------------------+ cfgadm_usb(1M), attributes(5), usba(7D) Writing Device Drivers Universal Serial Bus Specification 2.0 System Administration Guide: Basic Administration http://www.sun.com/io In addition to being logged, the following messages may also appear on the system console. Messages are formatted in the following manner: WARNING: <device path> <hubd<instance number>): Message... where <instance number> is the instance number of hubd and <device path> is the physical path to the device in /devices directory. Messages from the root hub are displayed with a usb<instance number> prefix instead of hub<instance number> as the root hub is an integrated part of the host controller. Connecting device on port <number> failed. The driver failed to enumerate the device connected on port <number> of hub. If enumeration fails, disconnect and re-connect. Use of a USB 1.0 hub behind a high speed port may cause unexpected failures. Devices connected to a USB 1.0 hub which are in turn connected to an external USB 2.0 hub, may misbehave unexpectedly or suddenly go offline. This is due to a documented incompatibility between USB 1.0 hubs and USB 2.0 hub Transaction Translators. Please use only USB 2.0 or USB 1.1 hubs behind high-speed ports. Connecting a high speed device to a non-high speed hub (port x) will result in a loss of performance. Please connect the device to a high speed port to get the maximum performance. USB 2.0 devices connected to USB 1.0 or 1.1 hubs cannot run at their highest speed, even when the hub is in turn connected to a high- speed port. For best performance, reconnect without going through a USB 1.0 or 1.1 hub. Cannot access <device>. Please reconnect. This hub has been disconnected because a device other than the original one has been inserted. The driver informs you of this fact by displaying the name of the original device. Devices not identical to the previous one on this port. Please disconnect and reconnect. Same condition as described above; however in this case, the driver is unable to identify the original device with a name string. Hub driver supports max of <n> ports on hub. Hence, using the first <number of physical ports> of <n> ports available. The current hub driver supports hubs that have <n> ports or less. A hub with more than <n> ports has been plugged in. Only the first <n> out of the total <number of physical ports> ports are usable. The following messages may be logged into the system log. They are formatted in the following manner: <device path> <hubd<instance number>): message... Global over current condition, please disconnect hub. The driver detected an over current condition. This means that the aggregate current being drawn by the devices on the downstream port exceeds a preset value. Refer to section 7.2.1.2 and 11.13 of the Universal Serial Bus Specification 2.0. You must remove and insert this hub to render it and its downstream devices functional again. If this message continues to display for a particular hub, you may need to remove downstream devices to eliminate the problem. Local power has been lost, please disconnect hub. A USB self-powered hub has lost external power. All USB devices connected down-stream from this hub will cease to function. Disconnect the hub, plug in the external power-supply and then plug in the hub again. Local power has been lost, the hub could draw <x> mA power from the USB bus. A USB self/bus-powered hub has lost external power. Some USB devices connected down-stream from this hub may cease to func- tion. Disconnect the external power-supply and then plug in the hub again. 20 June 2005 hubd(7D)
All times are GMT -4. The time now is 10:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy