Replacing the date in a csv file with mm-yyyyHow to replace a character by a newline in VimCompare two dates with JavaScriptHow to check whether an object is a date?How to replace all occurrences of a string?How can I replace a newline (n) using sed?Detecting an “invalid date” Date instance in JavaScriptYYYY-MM-DD format date in shell scriptHow do I get the current date in JavaScript?How to format a JavaScript dateJavascript add leading zeroes to date

How do I address my Catering staff subordinate seen eating from a chafing dish before the customers?

Timing/Stack question about abilities triggered during combat

Terence Tao–type books in other fields?

How do I run a game when my PCs have different approaches to combat?

Print sums of all subsets

kids pooling money for Lego League and taxes

Commercial jet accompanied by small plane near Seattle

Why was Sauron preparing for war instead of trying to find the ring?

Giant alien flies into the solar system; the rocky planets are its eggs

Why are so many countries still in the Commonwealth?

How do I generate distribution of positive numbers only with min, max and mean?

Inadvertently nuked my disk permission structure - why?

Why/when is AC-DC-AC conversion superior to direct AC-Ac conversion?

What is "I bet" in German?

3D Statue Park: U shapes

What's the difference between 2a and 10a charging options?

Basic Questions on Wiener Filtering

Is it possible to access an array in a custom property in a driver?

Invert Some Switches on a Switchboard

What do teaching faculty do during semester breaks?

Did the IBM PC use the 8088's NMI line?

Singapore to Sydney to Canberra: where do we clear customs

Integral of the integral using NIntegrate

What is a Waiting Word™?



Replacing the date in a csv file with mm-yyyy


How to replace a character by a newline in VimCompare two dates with JavaScriptHow to check whether an object is a date?How to replace all occurrences of a string?How can I replace a newline (n) using sed?Detecting an “invalid date” Date instance in JavaScriptYYYY-MM-DD format date in shell scriptHow do I get the current date in JavaScript?How to format a JavaScript dateJavascript add leading zeroes to date






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have a csv file consisting of one column of dates. The date format is dd.mm.yyyy. How can I use sed to replace the date with the mm-yy format? That is, to replace the date with mm-yyyy, which is a text and dropping the day in the date. An example of the input csv file is:



11.12.2018
21.01.2019
07.02.2019
29.03.2019
01.04.2019


I would like the output to be:



12-18
01-19
02-19
03-19
04-19









share|improve this question
























  • Please take a look at How to create a Minimal, Complete, and Verifiable example. Please add sample input and your desired output for that sample input to your question.

    – Cyrus
    Mar 26 at 18:35

















0















I have a csv file consisting of one column of dates. The date format is dd.mm.yyyy. How can I use sed to replace the date with the mm-yy format? That is, to replace the date with mm-yyyy, which is a text and dropping the day in the date. An example of the input csv file is:



11.12.2018
21.01.2019
07.02.2019
29.03.2019
01.04.2019


I would like the output to be:



12-18
01-19
02-19
03-19
04-19









share|improve this question
























  • Please take a look at How to create a Minimal, Complete, and Verifiable example. Please add sample input and your desired output for that sample input to your question.

    – Cyrus
    Mar 26 at 18:35













0












0








0








I have a csv file consisting of one column of dates. The date format is dd.mm.yyyy. How can I use sed to replace the date with the mm-yy format? That is, to replace the date with mm-yyyy, which is a text and dropping the day in the date. An example of the input csv file is:



11.12.2018
21.01.2019
07.02.2019
29.03.2019
01.04.2019


I would like the output to be:



12-18
01-19
02-19
03-19
04-19









share|improve this question
















I have a csv file consisting of one column of dates. The date format is dd.mm.yyyy. How can I use sed to replace the date with the mm-yy format? That is, to replace the date with mm-yyyy, which is a text and dropping the day in the date. An example of the input csv file is:



11.12.2018
21.01.2019
07.02.2019
29.03.2019
01.04.2019


I would like the output to be:



12-18
01-19
02-19
03-19
04-19






date sed replace






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 18:57







Reza

















asked Mar 26 at 17:32









RezaReza

1486 bronze badges




1486 bronze badges












  • Please take a look at How to create a Minimal, Complete, and Verifiable example. Please add sample input and your desired output for that sample input to your question.

    – Cyrus
    Mar 26 at 18:35

















  • Please take a look at How to create a Minimal, Complete, and Verifiable example. Please add sample input and your desired output for that sample input to your question.

    – Cyrus
    Mar 26 at 18:35
















Please take a look at How to create a Minimal, Complete, and Verifiable example. Please add sample input and your desired output for that sample input to your question.

– Cyrus
Mar 26 at 18:35





Please take a look at How to create a Minimal, Complete, and Verifiable example. Please add sample input and your desired output for that sample input to your question.

– Cyrus
Mar 26 at 18:35












1 Answer
1






active

oldest

votes


















0














With GNU sed:



sed -r 's/...(..)...(..)/1-2/' file



-r: use extended regular expressions in the script.




Output:




12-18
01-19
02-19
03-19
04-19



See: The Stack Overflow Regular Expressions FAQ






share|improve this answer























  • I get the following error message: sed: illegal option -- r usage: sed script [-Ealn] [-i extension] [file ...] sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]

    – Reza
    Mar 26 at 19:33












  • You don't use GNU sed. Try to replace -r with -E.

    – Cyrus
    Mar 27 at 5:08










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55363105%2freplacing-the-date-in-a-csv-file-with-mm-yyyy%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














With GNU sed:



sed -r 's/...(..)...(..)/1-2/' file



-r: use extended regular expressions in the script.




Output:




12-18
01-19
02-19
03-19
04-19



See: The Stack Overflow Regular Expressions FAQ






share|improve this answer























  • I get the following error message: sed: illegal option -- r usage: sed script [-Ealn] [-i extension] [file ...] sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]

    – Reza
    Mar 26 at 19:33












  • You don't use GNU sed. Try to replace -r with -E.

    – Cyrus
    Mar 27 at 5:08















0














With GNU sed:



sed -r 's/...(..)...(..)/1-2/' file



-r: use extended regular expressions in the script.




Output:




12-18
01-19
02-19
03-19
04-19



See: The Stack Overflow Regular Expressions FAQ






share|improve this answer























  • I get the following error message: sed: illegal option -- r usage: sed script [-Ealn] [-i extension] [file ...] sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]

    – Reza
    Mar 26 at 19:33












  • You don't use GNU sed. Try to replace -r with -E.

    – Cyrus
    Mar 27 at 5:08













0












0








0







With GNU sed:



sed -r 's/...(..)...(..)/1-2/' file



-r: use extended regular expressions in the script.




Output:




12-18
01-19
02-19
03-19
04-19



See: The Stack Overflow Regular Expressions FAQ






share|improve this answer













With GNU sed:



sed -r 's/...(..)...(..)/1-2/' file



-r: use extended regular expressions in the script.




Output:




12-18
01-19
02-19
03-19
04-19



See: The Stack Overflow Regular Expressions FAQ







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 26 at 19:19









CyrusCyrus

50.4k5 gold badges41 silver badges84 bronze badges




50.4k5 gold badges41 silver badges84 bronze badges












  • I get the following error message: sed: illegal option -- r usage: sed script [-Ealn] [-i extension] [file ...] sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]

    – Reza
    Mar 26 at 19:33












  • You don't use GNU sed. Try to replace -r with -E.

    – Cyrus
    Mar 27 at 5:08

















  • I get the following error message: sed: illegal option -- r usage: sed script [-Ealn] [-i extension] [file ...] sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]

    – Reza
    Mar 26 at 19:33












  • You don't use GNU sed. Try to replace -r with -E.

    – Cyrus
    Mar 27 at 5:08
















I get the following error message: sed: illegal option -- r usage: sed script [-Ealn] [-i extension] [file ...] sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]

– Reza
Mar 26 at 19:33






I get the following error message: sed: illegal option -- r usage: sed script [-Ealn] [-i extension] [file ...] sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]

– Reza
Mar 26 at 19:33














You don't use GNU sed. Try to replace -r with -E.

– Cyrus
Mar 27 at 5:08





You don't use GNU sed. Try to replace -r with -E.

– Cyrus
Mar 27 at 5:08








Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55363105%2freplacing-the-date-in-a-csv-file-with-mm-yyyy%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해