BASH SCRIPT - Insert date into cells in cvs file

Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers BASH SCRIPT - Insert date into cells in cvs file
# 1  
Old 06-16-2017
BASH SCRIPT - Insert date into cells in cvs file

Hi, I'm looking to accomplish the following.
Insert current date into three places/cells within a cvs, every time the bash script is executed.

The cells are column A,B,C row 2. Row 1 is reserved for the headers.

The file name is always orders.csv. These three cells we always have an old date so they need to be updated when the script is ran.

Thank you
# 2  
Old 06-16-2017
You haven't shown any example of output or what you have tried on your own, so I give you this, based on your explanation.

perl -MPOSIX -ple '$_ = join ",",(strftime("%m/%d/%Y", localtime)) x 3 if $.==2' orders.csv

Last edited by Aia; 06-16-2017 at 01:02 AM.. Reason: added the orders.csv
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Bash: Insert in a variable a file

hi all i have a problem in the bash shell. i'd like insert in a variable a file for example : i have a file datafine.log in this file there is : 17/JUN/2019 i want to insert the value of datafine.log in a variable. Regards Frncesco edit by bakunin: please use CODE-tags for your data... (2 Replies)
Discussion started by: Francesco_IT
2 Replies

2. Shell Programming and Scripting

Insert values into a file 0 as per the date wise

Hi The file contains 12 months of date and less than 12 months of data I want to display if date filed less than 12 months of data I want to insert a value amount 1 to amount4 0 and dates as well. 12345|Date|cntry|amount1|amount2|amount3|amoun4... (2 Replies)
Discussion started by: jagu
2 Replies

3. Shell Programming and Scripting

Help with insert a value equation in bash script

HI All, I have a script in bash that i want that script will perform action When the size of a particular folder exceeds the 80%. Here is an example of script that result is exactly 80% : #!/bin/bash CHECK=$(df -h /var/log/syslog | grep '80%' | xargs echo | cut -d' ' -f5) if ];... (1 Reply)
Discussion started by: Aviel.shani
1 Replies

4. Shell Programming and Scripting

Bash script to count and insert

Hi not sure if this is possible but I need some help with a bash script, I have a text file and on the first line that starts with 7150230 I need it to put a 1 at position 79 and a 2 at position 88, this is where it gets complicated, on the next line it finds that starts with 7150230 I then need it... (8 Replies)
Discussion started by: firefox2k2
8 Replies

5. Shell Programming and Scripting

bash script search file and insert character when match found

Hi I need a bash script that can search through a text file and when it finds 'FSS1206' I need to put a Letter F 100 spaces after the second instance of FSS1206 The format is the same throughout the file I need to repeat this on every time it finds the second 'FSS1206' in the file I have... (0 Replies)
Discussion started by: firefox2k2
0 Replies

6. Shell Programming and Scripting

bash script to find date based on search string for continuesly updating file

Hi All, I am very new to UNIX and I have tried this for a longtime now and unable to crack it.... There is a file that is continuously updating. I need to search for the string and find the date @ which it updated every day..... eg: String is "work started" The log entry is as below: ... (1 Reply)
Discussion started by: Nithz
1 Replies

7. Shell Programming and Scripting

How to insert variable date (monthly) from SQL script

Hi Guys, Can someone please help me on adding/inserting a variable to an sql scipt? Basically I want to generate data on monthly (i.e. July 01, 2011 to July 31, 2011) basis. As shown below.. set head off; set linesize 300; set pagesize 200; spool /opt/oracle/temp/output.txt select... (1 Reply)
Discussion started by: pinpe
1 Replies

8. UNIX for Dummies Questions & Answers

Bash script to insert data into an html table

hi, I need to create a bash shell script which picks up data from a text file and in the output file puts it into an html made table. I have to use sed and awk utilties to do this the input text file will contain data in the format: job name para1 para2 para3 para4 para4 1 ... (1 Reply)
Discussion started by: intern123
1 Replies

9. Shell Programming and Scripting

How do I insert a line in the middle of a file in BASH?

I have tried sed '/6/a text_to_inserted' file > newfile but this inserts test_to_insert at random places in file and i want it in specific location, which is line 6. can anyone help.... (6 Replies)
Discussion started by: phenom
6 Replies

10. Shell Programming and Scripting

script grabbing cvs file .....

how do I write a script to checkout a file in cvs and cat the file into a file in my home directory Commands are cd /home/smr/sandbox cvsroot choose option 1 cvs co filename cat filename > /home/smr/newfilename Thank you! (4 Replies)
Discussion started by: llsmr777
4 Replies
Login or Register to Ask a Question

Featured Tech Videos