10 More Discussions You Might Find Interesting
1. Programming
I'm trying to print out integers and space/newline for a nicer output, for example, every 20 integers in a row with ternary operator.
In C I could do it with:printf("%d%s",tmp_int, ((j+1)%20) ? "\t":"\n"); but could not figure out the equivalent in C++:
cout << ((j+1)%20)?... (4 Replies)
Discussion started by: yifangt
4 Replies
2. Web Development
I have found this bit of code that nearly does what I want.
Basically 3 input fields, I want to copy t2 to t3 as it's typed but only if t1 contains data AND t3 is empty:
<input type="text" id="t1" />
<input type="text" id="t2" />
<input type="text" id="t3" />
<script> var t2 =... (4 Replies)
Discussion started by: barrydocks
4 Replies
3. Shell Programming and Scripting
Hello
I was working on a script where the output of my file is
1234
4567
8973
43214
78965
I need the value in below format of this file.The nth field should have space instead of ,(comma)
1234,4567,8973,43214 78965
I tried the code but not working completely
xargs <temp_PP.7250... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies
4. Shell Programming and Scripting
Hi experts,
I need to print the first field first then last two fields should come next and then i need to print rest of the fields.
Input :
a1,abc,jsd,fhf,fkk,b1,b2
a2,acb,dfg,ghj,b3,c4
a3,djf,wdjg,fkg,dff,ggk,d4,d5
Expected output:
a1,b1,b2,abc,jsd,fhf,fkk... (6 Replies)
Discussion started by: 100bees
6 Replies
5. Shell Programming and Scripting
Hi,
Consider the data (FS = |):
1| England |end
2| New Zealand |end
3|Australia|end
4| Some Made Up Country |end
5| West Indies|end
I want the output to be (i.e. without the leading and trailing white space from $2)
England
New Zealand
Australia
Some Made Up Country
West... (4 Replies)
Discussion started by: Storms
4 Replies
6. Shell Programming and Scripting
Dears,
I need a script or command which can find the unique number from the second filed and against that number it adds the total of first field .
17215630 , 0
907043 ,1
201050 ,10
394149 ,4
1964 ,9
17215630, 0
907043 ,1
201050, 10
394149 ,4
1964 ,9
1234234, 55
23 ,100
33 ,67
... (2 Replies)
Discussion started by: shary
2 Replies
7. Shell Programming and Scripting
hi
i have file as below , i want to add duplicate records like bell_bb to one record with valuve as 15 ( addition of both )
any oneline awk script to achive this ?
header 0
CAMPAIGN_NAME 1
Bell_BB 14
Bell_MONTHLY 803
SOLO_UNBEATABLE 644
Bell_BB 1
Bell_MONTHLY 25
SOLO_UNBEATABLE... (4 Replies)
Discussion started by: raghavendra.cse
4 Replies
8. Shell Programming and Scripting
Hello.
I'm using a file to "grep" in a 2nd one (with awk)
cat file1
2 first user
9 second user
1 third user (with a space after user)
I want to get the line except the 1st field so I do :
field=$(gawk '{$1 =""; print $0}' file | sed 's/^ //')
It works but it deletes... (5 Replies)
Discussion started by: xanthos
5 Replies
9. UNIX for Dummies Questions & Answers
How do I deal with extracting a portion of a record when multiple field separators are involved.
Let's say I have:
Mike Harrington;(555) 555-5555:250:100:175
Christian Dobbins;(555) 555-2358:155:90:201
Susan Dalsass;(555) 555-6279:250:60:50
Archie McNichol;(555) 555-1348:250:100:175
Jody... (3 Replies)
Discussion started by: doubleminus
3 Replies
10. UNIX for Dummies Questions & Answers
I have a bcp file that contains 10 fields. These fields are separated by a tab. How can I add my name as a new field in the 8th position for every record? I've been playing w/ sed and awk but can't seem to figure this out. (3 Replies)
Discussion started by: sasabune
3 Replies