10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I am writing a shell script where I want that # should be added in all those lines as the first character where the pattern matches.
file has lot of functions defined
a.sh
#!/bin/bash
fn a {
beautiful evening
sunny day
}
fn b {
}
fn c {
hello world .its a beautiful day
... (12 Replies)
Discussion started by: ashima jain
12 Replies
2. Shell Programming and Scripting
Hi all, I'm trying to match the following two files with the code below:
awk -F, 'NR==FNR {a=$0; next} ($12,$4) in a {print $12,$1,a}' OFS="," file4.csv file3.csv
but the code does not print the entire row from file4 in addition to column 12 and 1 of file3.
file4:
o,c,q,co,ov,b... (1 Reply)
Discussion started by: bkane3
1 Replies
3. Shell Programming and Scripting
I was wondering if I could use AWK to print from the nth character position to nth for all records in the file.
All I have been doing is printing/copying fields rather than characters. I found a way to print lines greater/less/equal to a character length which led me to believe there is a way... (3 Replies)
Discussion started by: MIA651
3 Replies
4. Shell Programming and Scripting
Hello All,
I have a .CSV file where I expect all numeric data in all the columns other than column headers.
But sometimes I get the files (result of statistics computation by other persons) like below( sample data)
SNO,Data1,Data2,Data3
1,2,3,4
2,3,4,SOME STRING
3,4,Inf,5
4,5,4,4
I... (9 Replies)
Discussion started by: ks_reddy
9 Replies
5. Shell Programming and Scripting
is there a short one-liner that can print out in columns instead of a long list?
as in, instead of:
apples
oranges
cats
dogs
sky
monkey
giraffe
cups
spoons
tv
cable
it'll print something like this (properly indented of course :) ): (9 Replies)
Discussion started by: SkySmart
9 Replies
6. Shell Programming and Scripting
Hi, I'm using a while-loop in an awk script. If it matches a regular expression, it prints a line. Unfortunately, each line that is printed in this loop is followed by an extra character, "1".
While-statement extracted from my script:
getline temp;
while (temp ~ /.* x .*/) print temp... (3 Replies)
Discussion started by: redbluefish
3 Replies
7. Shell Programming and Scripting
Im using awk to print columns. Basically I have a file with like 500 columns and I want to print the 200th-300th column and ignore the rest... how would I do it without putting $200, $201 .... $300
thanks (6 Replies)
Discussion started by: kylle345
6 Replies
8. Shell Programming and Scripting
hi guys, i would like to print two lines from a file as two adjacent columns using excel using awk.. i have this so far:
awk '{for(i=1; i<=NF; i++) {printf("%s\n",$i)}}' "$count".ttt > "$count".csv #this to print the first line from the .ttt file as rows of the first column in the .csv... (9 Replies)
Discussion started by: npatwardhan
9 Replies
9. UNIX for Dummies Questions & Answers
I am piping an "ls -l" to awk so that all it returns is the file size, date, and file name. The problem is that some files may have spaces in the name so awk is only printing the first word in the file name. I won't know how many space-delimited words are in the filename, so what I want to do is... (2 Replies)
Discussion started by: cassj
2 Replies
10. Shell Programming and Scripting
Here's what I wrote:
#!/bin/sh
d1=`grep Dialtone dialtone | awk '{print $2, $3, $4, $5, $6, $7, $8, $9}'`
d2=`grep pstsys dialtone | awk '{print $12}'`
echo "$d1 $d2"
I expected the result to be this:
Dialtone on host 1 slot 13 port 1, pstsys05
Dialtone on host 1 slot 13 port 1,... (3 Replies)
Discussion started by: cdunavent
3 Replies