10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Here is the whole script, very simple, but I am just learning
ROK_NO=$1
RPT=/tmp/test
sed -E '/^SELECT/ s/(.{23}).{8}/\1'"$ROK_NO"' /' $RPT
echo $RPT
When I run this I get
$ bash rok.sh 2388085
: No such file or directory
/tmp/test
When I type the command in console, it works... (3 Replies)
Discussion started by: isey78
3 Replies
2. Shell Programming and Scripting
Let's say I have an input file looking like:
ID1
1 5
6 8
ID2
1 4
5 7
I'm trying to formulate a loop that can combine these actions:
- If the line begins with a letter: replace the '\ n' after a field containing characters with a '\ t' (sed 's / \ n / \ t / g' )
- If the line... (2 Replies)
Discussion started by: dovah
2 Replies
3. Shell Programming and Scripting
i have a datafile that has several lines that look like this:
2,dataflow,Sun Mar 17 16:50:01 2013,1363539001,2990,excelsheet,660,mortar,660,4
using the following command:
awk -F, '{$3=strftime("%a %b %d %T %Y,%s",$3)}1' OFS=, $DATAFILE | egrep -v "\-OLDISSUES," | ${AWK} "/${MONTH} ${DAY}... (7 Replies)
Discussion started by: SkySmart
7 Replies
4. Shell Programming and Scripting
I can achieve two tasks with 2 different awk commands:
1) awk -F";;WORD" '{print $2}' file | sed '/^$/d' #to find surface_word
2) awk -F"bw:|gloss:" '// {print $2}' file | sed '/\//!d; s:/*+*: + :g; s:^+::; s: *+ *$::;' #to find segmentation of surface_word
Number 1) finds surface_word... (7 Replies)
Discussion started by: Viernes
7 Replies
5. Shell Programming and Scripting
I need to run a cronjob that will monitor a directory for files with a certain extension, when one appears I then need to run the below scripts How do I go about combining the following sed statements into one script? and also retain the original filename.?
sed 's/71502FSC1206/\n&/g' # add a... (2 Replies)
Discussion started by: firefox2k2
2 Replies
6. Shell Programming and Scripting
Hi,
I'm using AIX(ksh shell).
> cat temp.txt
"a","b",0
"c",bc",0
"a1","b1",0
"cc","cb",1
"cc","b2",1
"bb","bc",2
I want the output as:
"a","b","c","bc","a1","b1"
"cc","cb","cc","b2"
"bb","bc"
I want to combine multiple lines into single line where third column is same.
Is... (1 Reply)
Discussion started by: samuelray
1 Replies
7. UNIX for Dummies Questions & Answers
It would be convenient to be able to combine awk tests. For example, suppose that I do this query:
awk '$1 != "Bob" || $1 != "Linda" {print $2}' datafileIs there a reasonable way to combine the conditions into a single statement? For example, in egrep, I can do:
egrep -v "Bob|Linda"... (4 Replies)
Discussion started by: treesloth
4 Replies
8. Shell Programming and Scripting
Before I ask my actual question, is it going to be a problem that I want to run this process on a 15 Gig file that is ~140 million rows?
What I'm trying to do:
I have a file that looks like
Color,Type,Count,Day
Yellow,Full
5
Tuesday
Green,Half
6
Wednesday
Purple,Half
8
Tuesday
...... (3 Replies)
Discussion started by: goldfish
3 Replies
9. Shell Programming and Scripting
I am using:
ps -A -o command,%cpu
to get process and cpu usage figures. I want to use awk to split up the columns it returns. If I use:
awk '{print "Process: "$1"\nCPU Usage: "$NF"\n"}'
the $NF will get me the value in the last column, but if there is more than one word in the... (2 Replies)
Discussion started by: json4639
2 Replies
10. UNIX for Dummies Questions & Answers
I would like to change the lines:
originalline1
originalline2
to:
originalline1new
originalline1newline
originalline2new
originalline2newline
To do this, id like to combine the commands:
sed 's/^/&new/g' file > newfile1
and
sed '/^/ a\\
newline\\
\\ (2 Replies)
Discussion started by: Dave724001
2 Replies