10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
This is the first time I see something like this, and I don't why it happens.
Please give me some help. I am really appreciate it.
Basically I am trying to remove all empty lines of an input..
#!/bin/bash
set -e
set -x
str1=`echo -e "\nhaha" | grep -v ^$`
#str2=`echo -e "\n" |... (4 Replies)
Discussion started by: yoyomano
4 Replies
2. Shell Programming and Scripting
Hey Guys,
I have text such as this.
28003,ALCORN,2
28009,BENTON,2
28013,CALHOUN,2
28017,CHICKASAW,2
47017,CARROLL,2
05021,CLAY,0
The last digit after the final "," is a variable value. This is the base file. I have to do further execution on this file later and I need to update the... (7 Replies)
Discussion started by: chagan02
7 Replies
3. Shell Programming and Scripting
Hi All,
I have a fixed-width datafile from which i need to extract value/string starting from some position to the specified length in each of the lines.
awk '{print substr($0,x,y)}' datafile --- is working fine
but
awk 'BEGIN{a=0}{a=substr($0,x,y);print $a}' datafile ---is giving... (3 Replies)
Discussion started by: loggedin.ksh
3 Replies
4. Shell Programming and Scripting
Hello everyone,
My problem looks quite simple , how to assign a string with spaces and lines "\n" to a variable.
I've tried all kind of quoting and is impossible, bash always try to execute the string and never executes a simple assignation.
This is part of the code
... (1 Reply)
Discussion started by: trutoman
1 Replies
5. Shell Programming and Scripting
Hello,
I have a text file with n lines in the following format (9 column fields):
Example:
contig00012 149606 G C 49 68 60 18 c$cccccacccccccccc^c
I need to count the number of lower-case and upper-case occurences in column 9, respectively, of the... (3 Replies)
Discussion started by: s052866
3 Replies
6. Shell Programming and Scripting
Hi all,
Does anyone know how to code in ksh that will remove the first character in a string variable and replace that variable without the first character?
Example:
var1=ktest1 will become var1=test1
var2=rtest2 will become var2=test2
Need help please. (10 Replies)
Discussion started by: ryukishin_17
10 Replies
7. Shell Programming and Scripting
Hello all,
I have a file containing the following
p1 q1 p2 q2 p1 p2 p3
pr1 pr2 pr1 pr2
pa1 pa2
I want to remove the last character from all strings that start with 'p' and end with '1'. In general, I do not know what is between the first part of the string and the last part of the string.... (4 Replies)
Discussion started by: bigfoot
4 Replies
8. Shell Programming and Scripting
Hi folks.
I have this variable called FirstIN that contains something like this: 001,002,003,004...
I am trying to assign the content of this variable into ModifiedIN but with the following format : 001 002 003 004...(changing the commas for spaces)
I thought about using sed but i am not... (17 Replies)
Discussion started by: Stephan
17 Replies
9. UNIX for Dummies Questions & Answers
Good morning forums.
Ive been trying all weekend to do this with no luck, so i have come to the forums for help.
What i want to do is check if an inputed character is inside a variable.
for example,
if
var=1 2 3 4 5 6 7 8 9 0
i would like to see if a newly inputed number is already... (5 Replies)
Discussion started by: strasner
5 Replies
10. UNIX for Advanced & Expert Users
i have a string like echo "a|b|c" . i want to count the | symbols in this string . how to do this .plz tell the command (11 Replies)
Discussion started by: kamesh83
11 Replies