LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-21-2022, 04:02 PM   #16
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484

Quote:
Originally Posted by ceantuco View Post
How can I make the script read the text file?
Did you read the usage line in that sample script.?

The sample script I posted tells you how to do exactly that.
scriptname == the name of the script you want to execute
infile == the name of the input file being processed
outfile == the name of the file used to store the processed data
I even made sure the command line example in the script tied the data on the command line to the variables used within the script.

Thus the usage line gives you all the info you ask about.
This example command line
Code:
./myscriptfile mydatafile myresultsfile
would execute myscriptfile in the current pwd reading from mydatafile and writing to myresultsfile.

Your history of scripting indicates that you should understand the use of the variables $1, $2, etc. and what they represent within the script. If not then you really should start doing a little more in-depth studying of scripting. You have been given several references in this thread alone.
 
1 members found this post helpful.
Old 10-25-2022, 10:21 AM   #17
ceantuco
Member
 
Registered: Mar 2008
Location: New York
Distribution: Debian
Posts: 809

Original Poster
Rep: Reputation: 88
Thumbs down

Quote:
Originally Posted by computersavvy View Post
Did you read the usage line in that sample script.?

Your history of scripting indicates that you should understand the use of the variables $1, $2, etc. and what they represent within the script. If not then you really should start doing a little more in-depth studying of scripting. You have been given several references in this thread alone.
umm I got the script to work, yet I still got another lecture on this forum.... this is why people think Linux power users and programmers are rude....I even configured sendmail and added the line below to the script to email the file to users. Script has been added to cron job for automation and it is working thus, no need for more lectures.

echo "File" | mail -s "File" -r test@example.com user1@example.com, user2@example.com -A file_$(date +"%Y%m%d").csv
 
Old 10-25-2022, 11:16 AM   #18
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,753

Rep: Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983
Quote:
Originally Posted by ceantuco View Post
umm I got the script to work, yet I still got another lecture on this forum.... this is why people think Linux power users and programmers are rude....I even configured sendmail and added the line below to the script to email the file to users. Script has been added to cron job for automation and it is working thus, no need for more lectures.
Sorry if you think you're being 'lectured', but the other side of this is to consider why people are telling you this. When you're asking about scripts (this thread included) you typically show no efforts of your own, past stating what you want to do. So if you've been a user that long, been scripting that long, and have advised others to look at scripting tutorials, and have taken college-level courses in scripting, why can't you show us your efforts when asking for help?? Because as it is, you're essentially ask others to give you scripts, and seem to be confused as to why others get frustrated:
https://www.linuxquestions.org/quest...9/#post6369840
https://www.linuxquestions.org/quest...ml#post6352100
https://www.linuxquestions.org/quest...7/#post5830995
Quote:
Code:
echo "File" | mail -s "File" -r test@example.com user1@example.com, user2@example.com -A file_$(date +"%Y%m%d").csv
Why are you using echo? You can put the message body on the mail line as is.

Glad it's working for you, but insulting those who you come to for help isn't a good way to get more.
 
Old 10-25-2022, 11:58 AM   #19
ceantuco
Member
 
Registered: Mar 2008
Location: New York
Distribution: Debian
Posts: 809

Original Poster
Rep: Reputation: 88
Thumbs down

Quote:
Originally Posted by TB0ne View Post
Sorry if you think you're being 'lectured', but the other side of this is to consider why people are telling you this. When you're asking about scripts (this thread included) you typically show no efforts of your own, past stating what you want to do. So if you've been a user that long, been scripting that long, and have advised others to look at scripting tutorials, and have taken college-level courses in scripting, why can't you show us your efforts when asking for help?? Because as it is, you're essentially ask others to give you scripts, and seem to be confused as to why others get frustrated:
https://www.linuxquestions.org/quest...9/#post6369840
https://www.linuxquestions.org/quest...ml#post6352100
https://www.linuxquestions.org/quest...7/#post5830995

Why are you using echo? You can put the message body on the mail line as is.

Glad it's working for you, but insulting those who you come to for help isn't a good way to get more.
I did not insult anyone here. all I said it is that some of you are rude and love giving lecture to users.. I have read some of your comments to other users too.

I got it... next time I have a question, I will read a scripting book and the links I sent before "daring" to ask a question here. No wonder, it will never be the year of the Linux Desktop.
 
Old 10-25-2022, 01:00 PM   #20
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Quote:
Originally Posted by ceantuco View Post
I did not insult anyone here. all I said it is that some of you are rude and love giving lecture to users.. I have read some of your comments to other users too.

I got it... next time I have a question, I will read a scripting book and the links I sent before "daring" to ask a question here. No wonder, it will never be the year of the Linux Desktop.
And with this response you definitely define the fact that you DO insult those who are trying to assist. Calling us rude and 'lecturers' while failing to provide the requested feedback about what you have tried and what is failing, so we can see your own efforts and then provide suggestions makes you seem a 'help vampire'. (look that up if you do not understand the meaning)
The first 2 links I received are
https://en.wiktionary.org/wiki/help_...%20in%20return.
and
https://meta.stackoverflow.com/quest...a-help-vampire


There have been 20 posts on this thread, and only one contains a response from you about your own efforts to solve the question (and that was after being given 2 different very clear suggestions and one sample that you slightly modified.) Every other post you made was comments or complaints about the suggestions made including the fact that you have spent 14 years using linux and have never even learned how to check scripts with shellcheck. That comment serves to clearly demonstrate your lack of effort in learning the basic skills needed for linux, including the bash language and scripting.

It is clear that my 12 year old grandson knows more about scripting than you do since you seem to rely only upon the forums for answers instead of trying to learn for yourself.

Last edited by computersavvy; 10-25-2022 at 05:28 PM.
 
1 members found this post helpful.
Old 10-25-2022, 01:59 PM   #21
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,753

Rep: Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983
Quote:
Originally Posted by ceantuco View Post
I did not insult anyone here. all I said it is that some of you are rude and love giving lecture to users.. I have read some of your comments to other users too. I got it... next time I have a question, I will read a scripting book and the links I sent before "daring" to ask a question here.
Yes, you actually SHOULD try to learn things for yourself, and write your own scripts before posting...that is the entire purpose of help forums. To get HELP, not to have someone do it for you. Those are called "consultants" ...like the one you claimed to have hired to write this for you in post #10:
https://www.linuxquestions.org/quest...0/#post6387450
Quote:
No wonder, it will never be the year of the Linux Desktop.
Linux continues to gain more desktop acceptance, despite your assertion. And sorry, but asking you to show your own efforts to solve your own problem isn't outrageous, so please stop with the fake outrage. Or do you honestly think that if folks just had scripts written for them for free, by volunteers, that somehow Linux would be more popular??

Last edited by TB0ne; 10-25-2022 at 04:19 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
For multiple csv files how do I add the value of one particular entry in any given csv to that csv's name? sean mckinney Programming 8 01-22-2021 09:46 AM
How to print lines in csv file if 1 csv column field = "text". There are 10 column (;) in csv file nexuslinux Linux - Newbie 9 04-22-2016 11:35 PM
[SOLVED] input txt into some txt boxes siickboii Linux - Newbie 3 10-10-2012 05:28 PM
[SOLVED] awk question - read in txt files, offset data by given amount, output new txt files pomico Programming 19 09-17-2012 11:43 AM
cat onelinefile.txt >> newfile.txt; cat twofile.txt >> newfile.txt keep newline? tmcguinness Programming 4 02-12-2009 06:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration