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. Shell Programming and Scripting
Hello
I have had a requirement where I need to move data to a new line based on a text .So basically as soon as it encounters :61: it should move to a new line
Source Data :
:61:D100,74NCH1 :61:D797,50NCH2 :61:D89,38NCHK2 :61:D99,38NCHK12 :61:D79,38NCHK22 :61:D29,38NCHK5
Target Data... (11 Replies)
Discussion started by: kamijia83
11 Replies
3. Shell Programming and Scripting
I have file with SQL output as
0001 firstname1 lastname1 0002 firstname2 lastname2 0003 firstname3 lastname3 0004 firstname4 lastname4
Expected output :
0001 firstname1 lastname1
0002 firstname2 lastname2
0003 firstname3 lastname3
0004 firstname4 lastname4
Let me know if this can... (9 Replies)
Discussion started by: sameermohite
9 Replies
4. Shell Programming and Scripting
I am having a peculiar problem. First I run the code below to append 0 at the start of each line in some hundreds of files that I have in a directory. These files have each word in a newline.
for f in *.dat; do
echo "0" > tmpfile
cat $f >> tmpfile
mv tmpfile $f
done
Then I run this... (7 Replies)
Discussion started by: shoaibjameel123
7 Replies
5. UNIX for Advanced & Expert Users
I created a awk state to calculate the number of success however when the query runs it has a leading zero. Any ideas on how to remove the leading zero from the calculation?
Here is my query:
cat myfile.log | grep | awk '{print $2,$3,$7,$11,$15,$19,$23,$27,$31,$35($19/$15*100)}'
02:00:00... (1 Reply)
Discussion started by: bizomb
1 Replies
6. Shell Programming and Scripting
Hi Guys,
I have a file with content as below
aj.txt
"Iam
allfine" abcdef
abcd "all is
not well"
What I'm trying to say is my data has some new line characters in between quoted text. I must get ride of the newline character that comes in between the quoted text.
output must be:... (8 Replies)
Discussion started by: ajahuja
8 Replies
7. Shell Programming and Scripting
Input:
--------------------------
123asd 456sdasda 789a
-------------------------
output wanted:
---------------------
123asd
456sdasda
789a
----------------------
I want this by sed in simple way
please help (I know by: tr ' ' '\n' < inputfile )I want it by sed only (5 Replies)
Discussion started by: RahulJoshi
5 Replies
8. Shell Programming and Scripting
Hello,
I am currently trying to edit an ldif file. The ldif specification states that a newline followed by a space indicates the subsequent line is a continuation of the line. So, in order to search and replace properly and edit the file, I open the file in textwrangler, search for "\r " and... (14 Replies)
Discussion started by: rowie718
14 Replies
9. Shell Programming and Scripting
how to remove all tabs and newline (\n) from the exicting file (2 Replies)
Discussion started by: pvr_satya
2 Replies
10. UNIX for Advanced & Expert Users
no problem (6 Replies)
Discussion started by: angelina
6 Replies