10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have a issue, I need to loop through a comma delimited file and check for the length which exceeds specified length , if Yes truncate the string.
But my problem is , I do not have to check for all the fields and the field lenght is not same for all the fields.
For ex:
Say my line... (9 Replies)
Discussion started by: rashmisb
9 Replies
2. Shell Programming and Scripting
Hi,
I am trying to figure out how to get the length of the longest column in the entire file (because the length varies from one row to the other)
I was doing this at first to check how many fields I have for the first row:
awk '{print NF; exit}' file
Now, I can do this:
awk '{ if... (4 Replies)
Discussion started by: MIA651
4 Replies
3. Shell Programming and Scripting
cat T|awk -v format=$format '{ SUM += $1} END { printf format,SUM}'
the file T has below data
usghrt45tf:hrguat:/home/hrguat $ cat T
-1363000.00123456789
-95000.00789456123
-986000.0045612378
-594000.0015978
-368939.54159753258415
-310259.0578945612
-133197.37123456789... (4 Replies)
Discussion started by: zulfi123786
4 Replies
4. Shell Programming and Scripting
I would be grateful if someone could help me. I am trying to write a .sh script in UNIX.
I have the following code;
User=john
User=james
User=ian
User=martin
for x in ${User}
do
print ${#x}
done
This produces the following output;
4
5
3
6 (12 Replies)
Discussion started by: mmab
12 Replies
5. Shell Programming and Scripting
Hi All,
OS: Linux 86x64 bits Red Hat Linux
I get the email alert for the following when Alert condition is set for 30:
/dev/sda1 99M 21M 74M 22% /boot
-> Below 30%(Should not get the email alert)
Expected output as per E-Mail alert:
/dev/sda3 20G ... (2 Replies)
Discussion started by: a1_win
2 Replies
6. UNIX for Dummies Questions & Answers
Hi Guys,
I was going some trial and error to see if I can find the longest word in a text.
I was using Pipes because they are easier to use in this case.
I was stuck on this for a while so I thought I'll get some help with it.
I tried this code to separate all the words in a text in... (4 Replies)
Discussion started by: bawse.c
4 Replies
7. Shell Programming and Scripting
Good Morning/Afternoon All,
I am using the nawk utility in korn shell to find the longest field and display that result.
My Data is as follows:
The cat ran
The elephant ran
Milly ran too
We all ran
I have tried nawk '{ if (length($1) > len) len=length($1); print $1}' filename
The... (5 Replies)
Discussion started by: SEinT
5 Replies
8. Shell Programming and Scripting
Hello everyone...
I need to find out, how to find longest line or possibly lines in several files which are arguments for script. The thing is, that I tried some possibilities before, but nothing worked correctly.
Example
when i use:
awk ' { if ( length > L ) { L=length ;s=$0 } }END{ print... (23 Replies)
Discussion started by: 1tempus1
23 Replies
9. Shell Programming and Scripting
I have a number of unix text files containing fixed-length records (normal unix linefeed terminator) where I need to find odd records which are an incorrect length.
The data is not validated and records can contain odd backslash characters and control characters which makes them awkward to process... (2 Replies)
Discussion started by: methyl
2 Replies
10. Shell Programming and Scripting
Dear All,
To find the length of the longest line from a file i have used wc -L which is giving the proper output...
But the problem is AIX os does not support wc -L command.
so is there any other way 2 to find out the length of the longest line using awk or sed ?
Regards,
Pankaj (1 Reply)
Discussion started by: panknil
1 Replies