Replace with last date update


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Replace with last date update
# 8  
Old 09-25-2014
If you want to keep the sort, but get rid of the syntax errors in your date command and the last awk command, and produce output similar to what you said you want; you could try something like:
Code:
sort -rn file | awk 'BEGIN { FS = OFS = "|"} NR == 1 { d = $1 } { $1 = d } 1'

but Akshay's approach is much more efficient and produces the output you said you wanted.

Last edited by Don Cragun; 09-25-2014 at 07:32 AM.. Reason: There was also an unknown option in your 2nd awk.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Replace date in file every day with current date

I Have text like XXX_20190908.csv.gz need to replace Only date in this format with current date every day Thanks! (1 Reply)
Discussion started by: yamasani1991
1 Replies

2. UNIX for Beginners Questions & Answers

How to replace a parameter(variable) date value inside a text files daily with current date?

Hello All, we what we call a parameter file (.txt) where my application read dynamic values when the job is triggered, one of such values are below: abc.txt ------------------ line1 line2 line3 $$EDWS_DATE_INSERT=08-27-2019 line4 $$EDWS_PREV_DATE_INSERT=08-26-2019 I am trying to... (1 Reply)
Discussion started by: pradeepp
1 Replies

3. UNIX for Beginners Questions & Answers

“sed” replace date in text file with current date

We want to call a parameter file (.txt) where my application read dynamic values when the job is triggered, one of such values are below: abc.txt ------------------ Code: line1 line2 line3 $$EDWS_DATE_INSERT=08-27-2019 line4 $$EDWS_PREV_DATE_INSERT=08-26-2019 I am trying to write a... (3 Replies)
Discussion started by: pradeepp
3 Replies

4. UNIX for Beginners Questions & Answers

UNIX script to replace old date with current date dynamically in multiple files present in a folder

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

5. Shell Programming and Scripting

[Solved] Replace yesterday date with today's date except from the first line

Hello, I have a file like this: 2012112920121130 12345620121130msABowwiqiq 34477420121129amABamauee e7748420121130ehABeheheei in case the content of the file has the date of yesterday within the lines containing pattern AB this should be replaced by the current date. But if I use... (3 Replies)
Discussion started by: Lilu_CK
3 Replies

6. Shell Programming and Scripting

Replace date on a line with current date

Hi Guys, I have a file with following content From 20121014 : To 20121014 Number of days : 1 1234 1245 1246 1111 Everyday i run my script i want to modify "To" date on the first line with current date. I have set the current date in script as RUN_DATE=`date -u +%Y%m%d` So i want... (9 Replies)
Discussion started by: jakSun8
9 Replies

7. Shell Programming and Scripting

Searching for unknown date inside the file and replace to new date

Hello, Iam a newbies to Shell scripting. Iam trying to replace the date inside the file to new date. is there anyway that we can just use the pattern to search as "..." I have many files want to replace with the same date, and each file contains different date. Thanks for your help. ... (2 Replies)
Discussion started by: Daro
2 Replies

8. Shell Programming and Scripting

how to update date part with new increment date time

hi experts, my requirement is like this i need to develop a shell script to update date part with new incremental date time in file some 'X' which is kept at some server location incrementing every two hours.as i am new to this scripting i need support from u people,thanx in advance (1 Reply)
Discussion started by: amanmro
1 Replies

9. Shell Programming and Scripting

Search Replace and Update a file

hi, I am stuck at a place. Please help me out. Here is what i need to do. Search for a pattern in a propertyfile and change only at one occurance. I have these statements and assignment as a part of the propertyfile #Note : The Address should be replaced with actual address dynamically. ... (7 Replies)
Discussion started by: raghu_shekar
7 Replies

10. Shell Programming and Scripting

replace old date in scripts with new date

Hiee .... i want an immediate solution for this.... Let replace.cfg file contains a list of files to be replaced the old dates with new dates...... The script must take 3 parameters.... 1) old date 2) new date 3) .config file Can u get me the solution...... I tried with sed but i... (2 Replies)
Discussion started by: prasanna1983
2 Replies
Login or Register to Ask a Question
detect_spheres_matched_filter(1)		       The Computational Morphometry Toolkit			  detect_spheres_matched_filter(1)

NAME
detect_spheres_matched_filter - Detect spheres SYNOPSIS
detect_spheres_matched_filter InputImage OutputImage DESCRIPTION
This tool detects spherical objects in three-dimensional images. OPTIONS
Global Toolkit Options (these are shared by all CMTK tools) --help Write list of basic command line options to standard output. --help-all Write complete list of basic and advanced command line options to standard output. --wiki Write list of command line options to standard output in MediaWiki markup. --man Write man page source in 'nroff' markup to standard output. --version Write toolkit version to standard output. --echo Write the current command line to standard output. --verbose-level <integer> Set verbosity level. --verbose, -v Increment verbosity level by 1 (deprecated; supported for backward compatibility). --threads <integer> Set maximum number of parallel threads (for POSIX threads and OpenMP). Main Options --radius <double>, -r <double> Radius of spheres to detect in physical length units (typically mm). [Default: 1] --filter-margin <integer> Half of filter margin width in pixels. This determines the extent of the region around the surface or the sphere where the detection filter is non-zero. [Default: 2] --normalized Use intensity-normalized filter, effectively computing Normalized Cross Correlation between filter and image. AUTHORS
Torsten Rohlfing, with contributions from Michael P. Hasak, Greg Jefferis, Calvin R. Maurer, and Daniel B. Russakoff LICENSE
http://www.fsf.org/licensing/licenses/gpl.html BUGS
Report bugs at http://nitrc.org/projects/cmtk/ ACKNOWLEDGMENTS
From April 2009 through September 2011, CMTK Development and Maintenance was supported by the National Institute of Biomedical Imaging and Bioengineering under Grant No.R01 EB008381 (PI: Torsten Rohlfing). CMTK 2.2.2 Jul 20 2012 detect_spheres_matched_filter(1)