Sponsored Content
Top Forums Shell Programming and Scripting How to replace and amend value in the same time Post 302302219 by joeyg on Monday 30th of March 2009 11:37:20 AM
Old 03-30-2009
Hammer & Screwdriver what about this then?

Code:
> val1="2009/03/30 23:11:34.553 DFP"
> echo "$val1" | awk '{newh=substr($2,1,2)+1; endv=$3" "$4" "$5" "$6" "$7; if (newh==24){newh=00}; printf("%10s %2.2d%8s %-30s\n",$1,newh,substr($2,3,10),endv)}'
2009/03/30 00:11:34.553 DFP                           

> val1="2009/03/30 23:11:34.553 Pctreas no remark [2.3] (obsolete)"
> echo "$val1" | awk '{newh=substr($2,1,2)+1; endv=$3" "$4" "$5" "$6" "$7; if (newh==24){newh=00}; printf("%10s %2.2d%8s %-30s\n",$1,newh,substr($2,3,10),endv)}'
2009/03/30 00:11:34.553 Pctreas no remark [2.3] (obsolete)

 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to backup multiple files and amend their filenames

Hi, I'm trying to write a command that backs up certain files into my current directory and adds a prefix to the backed up file name. I realise this can be done in a script by specifying each individual file but would like to know if it can be done on one line and made an alias. I have the... (5 Replies)
Discussion started by: m223464
5 Replies

2. Shell Programming and Scripting

replace time format

Hello All, I have a problem with the following text file. For the field number 5 which is the time format (hh:mm:ss). But I would like to delete "ss" and showing hh:mm only. 00001,CLIENT,Company,1218,N,1:04,35,0.211,0,0.211,1.155531,0:00,0,0,0,0,0,1:04,35,0.211,0,0.211,1.155531,foold... (16 Replies)
Discussion started by: happyv
16 Replies

3. Solaris

Amend the size of a Partition Error

Hi guys, I'm fidling around Partition space on SMC and on changing partition size, or assiging an unused partition to "usr", or even trying to alter the disk layout I get: Attempted Format of Partition /dev/dsk/c1t0d0s3 failed with unexpected CIM error: CIM_ERR_FAILED:CIM_ERR_FAILED:... (2 Replies)
Discussion started by: drchris
2 Replies

4. Shell Programming and Scripting

amend ftp to sftp

Hi all, below is my current scriptftp -n << FTPCTRL open $my_ip user $my_user $my_pass ascii prompt off lcd $myDIR cd $ftp_cd $OPS $myfile FTPCTRLI'd like to amend it to sftp mode. Please advise the correct step.I consulted the man pages of sftp and I suppose I should be using the... (1 Reply)
Discussion started by: new2ss
1 Replies

5. UNIX for Advanced & Expert Users

Amend Unix hostname

Hi, Please could someone advise on the following if possible. I have built a unix server, and was given the wrong hostname. I need to amend the hostname to the correct name. And I don't want to rebuild the server again. I've tried the following to do change : hostname DTCT-TD3FIXI01A... (3 Replies)
Discussion started by: venhart
3 Replies

6. Shell Programming and Scripting

Amend File Without Changing Timestamp

Hi, Is it possible to amend a file without changing the last modified date? If it is, how do you do it? If it's not, is there a way to create an empty file with the same timestamp as another file? I know you can use touch -t yyyymmddhhmm.ss filename but, I would want the file to... (4 Replies)
Discussion started by: Ste_Moore01
4 Replies

7. Programming

Find gaps in time data and replace missing time value and column 2 value by interpolation in awk

Dear all, I am kindly seeking assistance on the following issue. I am working with data that is sampled every 0.05 hours (that is 3 minutes intervals) here is a sample data from the file 5.00000 15.5030 5.05000 15.6680 5.10000 16.0100 5.15000 16.3450 5.20000 16.7120 5.25000... (4 Replies)
Discussion started by: malandisa
4 Replies
LQR_CARVER_SET_PRESERVE_INP(3)				     LqR library API reference				    LQR_CARVER_SET_PRESERVE_INP(3)

NAME
lqr_carver_set_preserve_input_image - set a flag to preserve the buffer passed to a LqrCarver object upon creation SYNOPSIS
#include <lqr.h> void lqr_carver_set_preserve_input_image(LqrCarver* carver); DESCRIPTION
The function lqr_carver_set_preserve_input_image flags the LqrCarver object pointed to by carver so that it does not alter in any way the buffer which is passed to it by the constructor. It must be used before any resizing-related operation takes place, either after the carver construction or after the calls to lqr_carver_init(3) or lqr_vmap_load(3). SEE ALSO
lqr_carver_init(3), lqr_vmap_load(3), lqr_carver_set_enl_step(3), lqr_carver_set_resize_order(3), lqr_carver_set_dump_vmaps(3), lqr_carver_set_side_switch_frequency(3), lqr_carver_set_progress(3), lqr_carver_set_use_cache(3) COPYRIGHT
Copyright (C) 2007-2009 Carlo Baldassi LqR library 0.4.1 API (3:1:3) 10 Maj 2009 LQR_CARVER_SET_PRESERVE_INP(3)
All times are GMT -4. The time now is 03:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy