delete everything before specific position in a text fileText file look-up by columnshell script to do some...
How can I convince my reader that I will not use a certain trope?
Does a centaur PC also count as being mounted?
Math PhD in US vs Master + PhD in Europe
I played my first (rapid) tournament recently and I wanted to calculate my ELO
Cross over of arrows in a complex diagram
Reverse of diffraction
Why won't the ground take my seed?
Conduit Fill and Derating for THHN Cables (outdoor run)
For people who believe in Jesus and not the devil, what happend in the desert?
Could Sauron have read Tom Bombadil's mind if Tom had held the Palantir?
Equivalence classes of binary matrices under permutations of rows/columns
Averting Real Women Don’t Wear Dresses
How to convert object fill in to fine lines?
When to apply Lorentz transformations and laws of time dilations and length contractions: explanations
Why isn’t the tax system continuous rather than bracketed?
Polish letters in ASME English template
MH370 blackbox - is it still possible to retrieve data from it?
How do I find and plot the intersection of these three surfaces?
Children's short story about material that accelerates away from gravity
Why does this function call behave sensibly after calling it through a typecasted function pointer?
What is the olden name for sideburns?
Are there any vegetarian astronauts?
“Faire” being used to mean “avoir l’air”?
How well known and how commonly used was Huffman coding in 1979?
delete everything before specific position in a text file
Text file look-up by columnshell script to do some text manipulation of text file data structure and slight content changesHow to delete specific characters in a text fileWhat command(s) will feed a tab-delimited text file and cut each line to 80 characters?remove lines where a field's value is less than or equal to 3 - sed or awk?passing the results of awk command as a parameterHow to delete text in the file before and after some patternHow to delete lines in file from specific position to the end of the fileReferencing dynamically created table names in Create statement written in shell scriptPass range {$XX..$$YY} to cp command in bash script
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I have file "report.csv" . This report is generated based on few parameters
which can range from 1-10. So the report.csv has all the parameters printed in
it first and then , the main header and the data. Now I need to process
this file with the header and data and exclude all the parameters. The file looks like this
para_1: abc
para_2: def
para_3: ghi
.
.
.
para_n: xyz
Customer_Name, Customer_Number, .....
Jon Doe,19923
Adam Plak,19985
.
.
.
.
.
so on.
I used below command to get the position of the Column header
This gives me the position
grep -n "Customer_Name" report.csv | cut -d : -f1
(let's say) 13
Then I use this command to copy to another file and use the new file
sed '1,13d' report.csv >> report_test.csv
however i need to make it dynamic , like
$var1 = grep -n "Customer_Name" report.csv | cut -d : -f1
$var2 = d
sed '1,$var1$var2' report.csv >> report_test.csv
can you experts please help achieve this in Shell Script ?
shell-script
New contributor
add a comment |
I have file "report.csv" . This report is generated based on few parameters
which can range from 1-10. So the report.csv has all the parameters printed in
it first and then , the main header and the data. Now I need to process
this file with the header and data and exclude all the parameters. The file looks like this
para_1: abc
para_2: def
para_3: ghi
.
.
.
para_n: xyz
Customer_Name, Customer_Number, .....
Jon Doe,19923
Adam Plak,19985
.
.
.
.
.
so on.
I used below command to get the position of the Column header
This gives me the position
grep -n "Customer_Name" report.csv | cut -d : -f1
(let's say) 13
Then I use this command to copy to another file and use the new file
sed '1,13d' report.csv >> report_test.csv
however i need to make it dynamic , like
$var1 = grep -n "Customer_Name" report.csv | cut -d : -f1
$var2 = d
sed '1,$var1$var2' report.csv >> report_test.csv
can you experts please help achieve this in Shell Script ?
shell-script
New contributor
add a comment |
I have file "report.csv" . This report is generated based on few parameters
which can range from 1-10. So the report.csv has all the parameters printed in
it first and then , the main header and the data. Now I need to process
this file with the header and data and exclude all the parameters. The file looks like this
para_1: abc
para_2: def
para_3: ghi
.
.
.
para_n: xyz
Customer_Name, Customer_Number, .....
Jon Doe,19923
Adam Plak,19985
.
.
.
.
.
so on.
I used below command to get the position of the Column header
This gives me the position
grep -n "Customer_Name" report.csv | cut -d : -f1
(let's say) 13
Then I use this command to copy to another file and use the new file
sed '1,13d' report.csv >> report_test.csv
however i need to make it dynamic , like
$var1 = grep -n "Customer_Name" report.csv | cut -d : -f1
$var2 = d
sed '1,$var1$var2' report.csv >> report_test.csv
can you experts please help achieve this in Shell Script ?
shell-script
New contributor
I have file "report.csv" . This report is generated based on few parameters
which can range from 1-10. So the report.csv has all the parameters printed in
it first and then , the main header and the data. Now I need to process
this file with the header and data and exclude all the parameters. The file looks like this
para_1: abc
para_2: def
para_3: ghi
.
.
.
para_n: xyz
Customer_Name, Customer_Number, .....
Jon Doe,19923
Adam Plak,19985
.
.
.
.
.
so on.
I used below command to get the position of the Column header
This gives me the position
grep -n "Customer_Name" report.csv | cut -d : -f1
(let's say) 13
Then I use this command to copy to another file and use the new file
sed '1,13d' report.csv >> report_test.csv
however i need to make it dynamic , like
$var1 = grep -n "Customer_Name" report.csv | cut -d : -f1
$var2 = d
sed '1,$var1$var2' report.csv >> report_test.csv
can you experts please help achieve this in Shell Script ?
shell-script
shell-script
New contributor
New contributor
New contributor
asked 14 mins ago
PraveenPraveen
1
1
New contributor
New contributor
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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
});
}
});
Praveen is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f526552%2fdelete-everything-before-specific-position-in-a-text-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Praveen is a new contributor. Be nice, and check out our Code of Conduct.
Praveen is a new contributor. Be nice, and check out our Code of Conduct.
Praveen is a new contributor. Be nice, and check out our Code of Conduct.
Praveen is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- 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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f526552%2fdelete-everything-before-specific-position-in-a-text-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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