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

Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴