Question

In Linux, write a sed command to convert dates in the form mm-dd-yy to mm-dd-yyyy, assuming...

In Linux, write a sed command to convert dates in the form mm-dd-yy to mm-dd-yyyy, assuming the years are all in the 21st century.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

sed command:

echo "mm-dd-yy" | sed -n -e "s_\(...\)\(...\)\(..\)_\2\1\3_p"

"mm-dd-yy" is our format

\(...\)\(...\)\(..\) means it takes first 3 characters mm- and dd- and yy

\2\1\3 means arranging the dd as first and mm as second and yy as third

output:

note: if u have any doubt let me know.

Add a comment
Know the answer?
Add Answer to:
In Linux, write a sed command to convert dates in the form mm-dd-yy to mm-dd-yyyy, assuming...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a C++ program accepts a three-integer date in the following formats: mm/dd/yyyy or mm-dd-yyyy. Write...

    Write a C++ program accepts a three-integer date in the following formats: mm/dd/yyyy or mm-dd-yyyy. Write a Boolean function that validates the date. Note: account for leap years. After testing with single dates and verifying the algorithm works, set your program up to accept a file called dates.dat. Read the dates into your program and output bad dates to a file called bad_dates.dat.

  • Write a program that accepts a date from the user in the form mm/dd/yyyy

    # C PROGRAMMING LANGUAGEWrite a program that accepts a date from the user in the form mm/dd/yyyy and then dis- plays it in the form month dd, yyyy, where month is the name of the month: Enter a date (mm/dd/yyyy): 2/17/2011 You entered the date February 17, 2011 Store the month names in an array that contains pointers to strings.

  • Question 2: WRITE A C PROGRAMME TO Accept dates in ‘dd-mm-yyyy’ format into string variables and...

    Question 2: WRITE A C PROGRAMME TO Accept dates in ‘dd-mm-yyyy’ format into string variables and perform the following Validate the given date Find the difference between two dates Find whether date d1 is earlier than or later than or equal to the date d2 Total Marks : 35 USE THE FOLLOWING GUIDLINES String usage 10 marks Control Structures usage 10 marks Outputs Format 2.5 marks Correctness 2.5 marks Variables usage marks

  • Write a java program Problem 4 involves a date in the form of mm/dd/yyyy. You must...

    Write a java program Problem 4 involves a date in the form of mm/dd/yyyy. You must write a java program that checks if a date is valid or not , make sure that the program tells you where the error is in the program if there is one . I want you to work with characters and the switch statement, and write out a reason for each incorrect input value. .

  • Write a program that prompts the user to enter the date in mm/dd/yyyy format. The program...

    Write a program that prompts the user to enter the date in mm/dd/yyyy format. The program should use a single input statement to accept the date, storing each piece of the date into an appropriate variable. Demonstrate that the input was obtained correctly by outputting the month, day, and year to the screen. Sample output: Enter (date (mm/dd/yyyy): 02/08/2011 Month entered: 2 Day entered: 8 Year entered: 2011 Challenge: Although the user entered 02, C++ drops the 0 as insignificant...

  • QUESTION 1 What will be the output of following Unix command: find / -name ‘*’ A....

    QUESTION 1 What will be the output of following Unix command: find / -name ‘*’ A. List all files and directories recursively starting from / B. List a file names * in / C. List all files in / directory D. List all files and directories in / directory QUESTION 2 Which command is used to extract a column/field from a text file / input. A. paste B. get C. cut D. tar QUESTION 3 Which command creates an empty...

  • Credit Card Fraud: From a dataset of the form [Account, Company, Date[DD/MM/YYYY], Fraudulent charge [boolean]] find...

    Credit Card Fraud: From a dataset of the form [Account, Company, Date[DD/MM/YYYY], Fraudulent charge [boolean]] find the merchant that was originally compromised in the dataset. Look for a large number of accounts interacting with the company a few days before fraudulent charges are seen in the accounts. Using python, what approach would you use? Name any packages/ ML libraries or other that would be utilized.

  • Write a C++ program that determines the user's age after the   user enters both the current...

    Write a C++ program that determines the user's age after the   user enters both the current date and hisher birthdate as 3   integers:                yyyy mm dd                                                                                             Define a class which is named DateType and will be used to     declare 2 objects: "birthday" and "today". The class will have a function "output" which will display the date in conventional form (like it is above next to Date Assigned: Month dd, yyyy and it will have a second function named     “input”...

  • Write a C++ program that determines the user's age after the user enters both the current...

    Write a C++ program that determines the user's age after the user enters both the current date and hisher birthdate as 3 integers: yyyy mm dd Define a class which is named DateType and will be used to declare 2 objects: "birthday" and "today". The class will have a function "output" which will display the date in conventional form (like it is above next to Date Assigned: Month dd, yyyy EXAMPLE: If the user entered the #’s: 2018 2 6...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT