Sponsored Content
Top Forums Shell Programming and Scripting Need to add a date column (today's date) in file Post 302834859 by vijay_rajni on Saturday 20th of July 2013 06:56:47 AM
Old 07-20-2013
Need to add a date column (today's date) in file

Hi

I have file with number status and date1 and date1 field,

want add a column today between column date1 and date2.

file1.txt

Code:
number status  date1  date2  
=====  ====   ===      ===== 
34567 open 27/06/13 28/06/13 
45678 open 27/06/13 28/06/13 
43567 open 27/06/13 28/06/13 
24578 open 28/06/13 28/06/13 
45890 open 28/06/13 28/06/13 
43599 open 27/06/13 28/06/13 
25578 open 28/06/13 28/06/13 
51890 open 28/06/13 28/06/13


desire file

Code:
number status  date1    today     date2  
=====  ====   ===  ==         ===== 
34567 open 27/06/13   20/7/13      28/06/13 
45678 open 27/06/13   20/7/13      28/06/13 
43567 open 27/06/13   20/7/13      28/06/13 
24578 open 28/06/13   20/7/13      28/06/13 
45890 open 28/06/13   20/7/13      28/06/13 
43599 open 27/06/13   20/7/13      28/06/13 
25578 open 28/06/13   20/7/13      28/06/13 
51890 open 28/06/13   20/7/13      28/06/13

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

compare today's date with date in a file

Hi I am very new to scripting, Can someone show me how to (in unix shell script) compare the system's date with a date in a file. The requirement is to somehow open this file (which will only have a date in it) and compare it with today's date. If they are equal execute a procedure below but if... (4 Replies)
Discussion started by: siog
4 Replies

2. UNIX for Dummies Questions & Answers

Shell Scripts - shows today’s date and time in a better format than ‘date’ (Uses positional paramete

Hello, I am trying to show today's date and time in a better format than ‘date' (Using positional parameters). I found a command mktime and am wondering if this is the best command to use or will this also show me the time elapse since 1/30/70? Any help would be greatly appreciated, Thanks... (3 Replies)
Discussion started by: citizencro
3 Replies

3. UNIX for Dummies Questions & Answers

Delete a row from a file if one column containing a date is greater than the current system date

Hello gurus, I am hoping someone can help me with the required code/script to make this work. I have the following file with records starting at line 4: NETW~US60~000000000013220694~002~~IT~USD~2.24~20110201~99991231~01~01~20101104~... (4 Replies)
Discussion started by: chumsky
4 Replies

4. Emergency UNIX and Linux Support

Trying to add currrent date as the first the first column in the file

Hi Experts, I am trying to add one variable value as the first value in a file speparated by "" (space) delimiter. Can you please let me know how I can do this using bash script. Following is my file. 1635 ABCD 3m9ka COMPLETE 0526 AJAY 3m1da COMPLETE 0419 INDIA 3m3zi INCOMPLETE The... (3 Replies)
Discussion started by: ajaypatil_am
3 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

UNIX date fuction - how to deduct days from today's date

Hi, One of my Unix scripts needs to look for files coming in on Fridays. This script runs on Mondays. $date +"%y%m%d" will give me today's date. How can I get previous Friday's date.. can I do "today's date minus 3 days" to get Friday's date? If not, then any other way?? Name of the files is... (4 Replies)
Discussion started by: juzz4fun
4 Replies

7. UNIX for Advanced & Expert Users

Script to rename file that was generated today and which starts with date

hello, can someone please suggest a script to rename a file that was generated today and filename that being generated daily starts with date, its a xml file. here is example. # find . -type f -mtime -1 ./20130529_4995733057260357019.xml # this finename should be renamed to this format.... (6 Replies)
Discussion started by: bobby320
6 Replies

8. UNIX for Advanced & Expert Users

Add file creation date as new column

Hi , I have a requirement to append file creation date to each row in a file for all the files in a directory. Please help Thanks, Pavan (2 Replies)
Discussion started by: Pavan Ram B S
2 Replies

9. UNIX for Beginners Questions & Answers

Find and copy .zip file based on today's date

Hi Team, I'm new to unix and i have a requirement to copy or move files from one directory to another based on current date mentioned in the .zip file name. Note that i need to copy only the recent zip file. please help me with the code i tried the code as: #! /usr/bin/sh find... (3 Replies)
Discussion started by: midhun3108
3 Replies

10. UNIX for Beginners Questions & Answers

Compare Date to today's date in shell script

Hi Community! Following on from this code in another thread: #!/bin/bash file_string=`/bin/cat date.txt | /usr/bin/awk '{print $5,$4,$7,$6,$8}'` file_date=`/bin/date -d "$file_string"` file_epoch=`/bin/date -d "$file_string" +%s` now_epoch=`/bin/date +%s` if then #let... (2 Replies)
Discussion started by: Greenage
2 Replies
OPEN(1) 							     Linux 1.x								   OPEN(1)

NAME
open - start a program on a new virtual terminal (VT). SYNOPSIS
open [-c vtnumber] [-s] [-u] [-l] [-v] [--] command command_options DESCRIPTION
open will find the first available VT, and run on it the given command with the given command options, standard input, output and error are directed to that terminal. The current search path ($PATH) is used to find the requested command. If no command is specified then the envi- ronment variable $SHELL is used. OPTIONS -c vtnumber Use the given VT number and not the first available. Note you must have write access to the supplied VT for this to work. -s Switch to the new VT when starting the command. The VT of the new command will be made the new current VT. -u Figure out the owner of the current VT, and run login as that user. Suitable to be called by init. Shouldn't be used with -c or -l. -l Make the command a login shell. A - is prepended to the name of the command to be executed. -v Be a bit more verbose. -w wait for command to complete. If -w and -s are used together then open will switch back to the controlling terminal when the command completes. -- end of options to open. NOTE
If open is compiled with a POSIX (Gnu) getopt() and you wish to set options to the command to be run, then you must supply the end of options -- flag before the command. EXAMPLES
open can be used to start a shell on the next free VT, by using the command: open bash To start the shell as a login shell, use: open -l bash To get a long listing you must supply the -- separator: open -- ls -l SEE ALSO
login(1), doshell(8), switchto(1). AUTHOR
Jon Tombs <jon@gtex02.us.es or jon@robots.ox.ac.uk> -w idea from "sam". 19 Jul 1996 V1.4 OPEN(1)
All times are GMT -4. The time now is 11:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy