10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Hi,
I am trying to remove trailing zeros from numbers in a csv file.
CSV Input : 0.5000,abc,2.00,2.400,285.850,285a.850,205.180800,mno000,a0b0,2.860
Expected Output :
.5,abc,2,2.4,285.85,285a.850,205.1808,mno000,a0b0,2.86
Can you please help.
Thanks. (11 Replies)
Discussion started by: manubatham20
11 Replies
2. Shell Programming and Scripting
Dear All,
assume i have a file with content:
<Start>6000</Start>
<Stop>7599</Stop>
the output is:
6000
7000
7100
7200
7300
7400
7599
how should we use any awk, sed, perl can do this task, means to extract the uniq prefixes from the start and stop prefix.
Thanks
Jimmy (3 Replies)
Discussion started by: jimmy_y
3 Replies
3. Shell Programming and Scripting
Hi Forum.
I'm running the following awk command to extract the suffix value (pos 38) from the "AM00" record and append to the end of the "AM01" record.
awk 'substr($0,13,4)=="AM00" {SUFFIX = substr($0,38,2)} substr($0,13,4)=="AM01" {$0 = $0 SUFFIX} 1' before.txt > after.txt
Before.txt:... (2 Replies)
Discussion started by: pchang
2 Replies
4. Shell Programming and Scripting
Hi,
i have a variable which conatins values like 00001,0003,00067,00459.
I want to use the values one by one and in the same form as they are like 00001,0003,00067,00459.
Also can anyone tell me how to increment those numbers by 1,keeping the format as same like 00002,0004,00068,00460.... (5 Replies)
Discussion started by: arijitsaha
5 Replies
5. Shell Programming and Scripting
Hi All,
I have 100 files with names like this:
1.dat, 2.dat, 3.dat until 100.dat.
My dat files look like this:
42323 0
438939 1
434 0
0.9383
3434
120.23 3
234
As you can see in the second column, some numbers are missing. I want to fill those missing places with 0's in all... (3 Replies)
Discussion started by: shoaibjameel123
3 Replies
6. Shell Programming and Scripting
hi
i want to append zeros to a given number ( varying digits). the total length of the output should be 10 digits. For example:
1)input is var=347
output should be NewVar=0000000347
2) input is var=123456
output should be NewVar=0000123456
i am able to acheive this using typeset... (1 Reply)
Discussion started by: somi2yoga
1 Replies
7. UNIX for Dummies Questions & Answers
Hello,
Hello,
I use the following command to split a file:
split -Number_of_Lines Input_File MyPrefix_
output is
MyPrefix_a
MyPrefix_b
MyPrefix_c
......
Instead, how can I get numerical values like:
MyPrefix_1
MyPrefix_2
MyPrefix_3
...... (2 Replies)
Discussion started by: Gussifinknottle
2 Replies
8. UNIX for Dummies Questions & Answers
We are running AIX. Shell is ksh. I used to have the ability to recall commands from prior sessions using <exc> k. Now, suddenly, I only can recall commands run during the current session. When I start a session, I have no command history. Also, when I run the shell command from a current... (1 Reply)
Discussion started by: boylepeterj
1 Replies
9. Shell Programming and Scripting
I want an integer to be prefix with some zeros so that it makes the integer 5 digit always:
For eg: if the digit is 8 i need 00008
if the digit is 8976 ans sud be 08976.
Could anyone say simple and efficient commands to this in ksh.
Thanks a lot... (4 Replies)
Discussion started by: PRKS
4 Replies
10. Shell Programming and Scripting
Hope somebody is happy.
NR==1 {
num_columns=split( $0, menuend );
next;
}
{
split( $0, substrend );
for ( i=1; i<=NF; i++ ) {
minuend -= substrend;
}
}
END {
print "Result:";
for ( i=1; i<=num_columns; i++ ) {
printf(... (3 Replies)
Discussion started by: awkward
3 Replies