10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a lot of file with a lot of lines following the same pattern
the lines go like this:
alpha_9/output- -413.74928476 2.6116
and I want it to be:
9 -413.74928476 2.6116
thanks for the help (5 Replies)
Discussion started by: galboski
5 Replies
2. Shell Programming and Scripting
Split column data if the table has n number of column's with some record then how to split n number of colmn's line by line with records
Table
---------
Col1 col2 col3 col4 ....................col20
1 2 3 4 .................... 20
a b c d .................... v
... (11 Replies)
Discussion started by: Priti2277
11 Replies
3. Shell Programming and Scripting
please write a shell script
Table
--------------------------
1 2 3 a b c
3 4 5 c d e
7 8 9 f g h
Output should be like this
---------------
1 2 3
3 4 5
7 8 9
a b c
c d e
f g h (1 Reply)
Discussion started by: Priti2277
1 Replies
4. Programming
I'm trying to solve the below problem for a number:
Enter a number and if it has all unique digits print unique number else non-unique number.
Eg:
Input=123; Output=unique number
Input=112; Output=Non-unique number
The thing i tried is splitting the number into digits by using % operator... (2 Replies)
Discussion started by: Gautham
2 Replies
5. Shell Programming and Scripting
Input file :
5 20
500 2
20 41
41 0
23 1
Desired output :
5
2
20
0
1
By comparing column 1 and 2 in each line, I hope can print out the column with smallest number.
I did try the following code, but it don't look good :( (2 Replies)
Discussion started by: perl_beginner
2 Replies
6. Shell Programming and Scripting
hi All,
i have a file in which only one column is there.,
test.txt
======
-900.01
-900.02
-900.03
-900.04
-900.05
-900.06
-900.07
-900.08
-900.09
900.01
900.02
900.03
900.04
900.05 (4 Replies)
Discussion started by: mechvijays
4 Replies
7. UNIX for Dummies Questions & Answers
Hi!
Is there an easy way (maybe using awk??) to divide the values of one column of the file by it's first entry..
If I have a column:
3
4
5
6
7
I would like to divide it by 3.
I want to do this for more than 100 files, so it wouldn't be practical to open file by file and... (26 Replies)
Discussion started by: cosmologist
26 Replies
8. Shell Programming and Scripting
All,
$ cat myf.txt
A|xyz|1000|mm
B|9000|xyz|ss
C|BDE|2000|kk
D|xyz|1000|nn
I am searching "xyz"
$ awk -F "|" '
{for(k=0;k<=NF;k++)
if ( $k == "xyz" )
print "line="NR"(column="k")"
}' myf.txt
Output:
line=1(column=2)
line=2(column=3)
line=4(column=2) (2 Replies)
Discussion started by: jkl_jkl
2 Replies
9. Shell Programming and Scripting
Hi all,
i was doing a small program where if i was to be given the first 3 letters of any month i.e. in the form of Jan or Apr then it would return the column number where it finds a match. To do this i created a 12 element array of months with first 3 letters and if i echo'ed the contents of... (2 Replies)
Discussion started by: scriptingmani
2 Replies
10. UNIX for Dummies Questions & Answers
I need to find to find duplicate lines in a document and then print the line numbers of the duplicates
The files contain multiple lines with about 100 numbers on each line I need something that will output the line numbers where duplicates were found ie 1=5=7, 2=34=76
Any suggestions would be... (5 Replies)
Discussion started by: stresslog
5 Replies