10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi fellow linux-ers,
I have a quick question for you. I have the following text, which I would like to modify:
10 121E(121) 16 Jan
34S 132E 24 Feb
42 176E(176) 18 Sep
21S 164E 25 May
15 171W(-171) 09 Jul
How can I do the following 2 modifications using sed and/or awk?
1. in 1st column,... (1 Reply)
Discussion started by: lucshi09
1 Replies
2. Shell Programming and Scripting
Just want to know why when I do the following in sed, the required is not extracted.
echo "ab01cde234" | sed 's/*$//'
result: ab01cde (Which is correct)
echo "ab01cde234" |sed 's/.*\(*\)$/\1/'
result: blank (was expecting 234)
or
echo "ab01cde234" |sed 's/.*\(\)*$/\1/'
result: blank... (6 Replies)
Discussion started by: eo29
6 Replies
3. Shell Programming and Scripting
Hello,
I have a quick reference question:
I have a very long, but fairly straigtforward script written in c-shell. I was wondering if it is possible to call this script from bash (for ex. having a function in bash script which calls the c-shell script when necessary), and if so, are there any... (1 Reply)
Discussion started by: lapiduslost
1 Replies
4. Shell Programming and Scripting
Need to subtract date stored in variable from the current date, answer should come in days..and months.
Suppose two variable having value like
A=”Wed Jan 15 08:59:08 GMT 2014”
B= `date` #Sun May 23 09:29:40 GMT 2010
SubtractAB= $A-$B #..?
AddAB=$A+$B #... ?
C=$B+9 # Sun May 23... (3 Replies)
Discussion started by: KuldeepSinghTCS
3 Replies
5. Shell Programming and Scripting
First off I have read the man pages for sed and am still having trouble working on a script to remove portions of a log:
My goal is to take a log file to be emailed, read the file and strip the portions away AFTER the line MIME-Version:1.0
and strip away until it to the line starting with... (4 Replies)
Discussion started by: murphybr
4 Replies
6. Shell Programming and Scripting
Hello,
i want to take the input from user and according to that variable's value search in file emp.lst. Here is what i came up with
echo -e "Enter string to be searched :\c"
read str
sed -n '/\$str/p' emp.lst
this is not working! any idea why?Thanks in advance! :) (4 Replies)
Discussion started by: salman4u
4 Replies
7. Shell Programming and Scripting
I have a current code working(named subst1) having a user be able to type this line to substitute words using the sed command:
subst1 old-pattern new-pattern filename
Here is my shell script:
#!/bin/bash
# subst1
ARGS=3
E_BADARGS=65
if
then
echo "Usage: `basename $0`... (1 Reply)
Discussion started by: Todd88
1 Replies
8. Shell Programming and Scripting
Cool. I played with scripts at home over the weekend. Come to find out not working on other shells. I have linux/bash at home, but now I'm trying on Solaris csh.
How would I write the following script for Solaris C shell?
----------
#!/bin/bash
NBR=231
for ((i = 0; i < $NBR; i++ ))
do... (1 Reply)
Discussion started by: ajp7701
1 Replies
9. Shell Programming and Scripting
hey,
Im just wondering is there away to get sed to read from a variable
eg
it doesn't seem to work, i really need to be able to recursively change the same data set... (2 Replies)
Discussion started by: vbm
2 Replies
10. Shell Programming and Scripting
I have a line
EXTDIR=`echo $i | sed 's/\-tar.gz//'`
which looks for files ending in -tar.gz, i would like to increase the functionality so that it looks for .tar.gz files as well as -tar.gz. Do i put the - in square brackets with a dot ? like this
EXTDIR=`echo $i | sed 's/\tar.gz//'`
... (1 Reply)
Discussion started by: hcclnoodles
1 Replies