10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have one text file
1 2 3
a 5
4 4 3
where i want to print the line number
while read line
do
line_no=`awk '{print NR, $0}'`
echo 'In line no $line_no'
done <$txt_file
If i run the above code, it will print
'In line no 1 1 2 3'
It prints the line number with the whole... (3 Replies)
Discussion started by: RJG
3 Replies
2. Shell Programming and Scripting
I wish to print my current shell which happens to be bash in my script check.sh
more check.sh
echo $0
echo `ps -p $$`
But instead of printing it prints check.sh i.e the name of the script for both the commands.
Can you please suggest how to print the current shell i m on inside the... (2 Replies)
Discussion started by: mohtashims
2 Replies
3. Shell Programming and Scripting
Hi
I have been using sed -n -e '/regex/{N;p;}' to print the matching line and the next line.
In cases where I have a matching line at the end of the document with no next line, that line is skipped. How do I print that line as well?
Thanks. (10 Replies)
Discussion started by: jamie_123
10 Replies
4. Shell Programming and Scripting
I have a text file which is having 30000 lines in it. I have to create a xml file for each 10000 lines until all the lines in the text files are written. Also please help how can i get number of lines in the text file in a shell variable? (19 Replies)
Discussion started by: vel4ever
19 Replies
5. Shell Programming and Scripting
Hi,
I want to subtract 'n' days from the current timestamp in a k shell script. Is there any inbuilt function to do it
or any workaround solution to get the date. And I want the output to be in YYYY:MM:DD HH:MM:SS format. Please help.
Thanks in advance. (4 Replies)
Discussion started by: Suryaaravindh
4 Replies
6. Shell Programming and Scripting
Hi,
I have created one shell script in which it will count number of "~" tilda charactors from each line of the file.But the problem is that i need to count each line count individually, that means. if line one contains 14 "~"s and line two contains 15 "~"s then it should give an error msg.each... (3 Replies)
Discussion started by: Ganesh Khandare
3 Replies
7. Shell Programming and Scripting
Hi,
I have a log file, where i am required to identify the line number, where a particular string/line appears in the log file.
And then copy 200 lines above that line number to a new file.
Can someone provide pointers on how to write this script or what command to be used ?
Any... (2 Replies)
Discussion started by: kk2202
2 Replies
8. Shell Programming and Scripting
hello unix-people.
can u please tell me how i can get the current bandwidth usage of my machine on shell into variables?
thanks a lot (2 Replies)
Discussion started by: scarfake
2 Replies
9. Shell Programming and Scripting
Hello all,
I'm new to shell programming and need some help. I would like to set up a step within a shell script to trigger another shell script to run, based on the highest return code generated in the current script. For example, if the highes return code value in the current script is less... (1 Reply)
Discussion started by: mmignot
1 Replies
10. Shell Programming and Scripting
How do i run a shell script or perl script with in the context of a current shell.
I know that i can use command source. but we can't pass any arguments to
our script if we use source command as it takes only one argement i.e filename
Is there any way to run a script in the current shell... (5 Replies)
Discussion started by: Naresh Kumar
5 Replies