10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I need to write a BASH script that takes a 2 character string and removes the second character if it is not a digit e.g.
If the string is numberical value >9 e.g. string1 = '34' then leave string1 = '34'.
However if the string is <10 e.g. string1 = '3X' then remove the second char (which... (7 Replies)
Discussion started by: millsy5
7 Replies
2. Shell Programming and Scripting
Hi
I need to remove "|" char when it's the last char of the line.
Input file:
generoso|desprendido|altruista|
abnegar|ceder|sacrificar|
abocetado-da|esbozado|
apuntado|insinuado|incompleto
abocetar|esbozar|bosquejar|
diseņar|delinear
------------------------ output need ---
... (11 Replies)
Discussion started by: lookoo
11 Replies
3. Shell Programming and Scripting
How to remove x lines form top and y lines form bottom.
This works, but like awk only cat file | head -n-y | awk 'NR>(x-1)'
so remove last 3 lines and 5 firstcat file | head -n-3 | awk 'NR>4' (5 Replies)
Discussion started by: Jotne
5 Replies
4. Shell Programming and Scripting
HI
Input A.txt
ABC907 ABC907_1B_9
ABC985 ABC985_1A_9
ABC985 ABC985_1B_9
ABC985 ABC985_1C_9
ABC05037 ABC05037_1A_9
ABC05037 ABC05037_1B_9
Base of column 2 last third char.
If It is A the 1,if B then 2 If C then 3
File B.txt
ABC907 ABC907_1B_9 2
ABC985 ABC985_1A_9 1
ABC985... (8 Replies)
Discussion started by: asavaliya
8 Replies
5. UNIX Desktop Questions & Answers
I wanted to remove junk char in my csv. :mad:
Input file format:
"17","9986782190","0","D","2"
"17","9900918331","0","D","2"
"13","9986782194","0","A","2"
Output file format
9986782190
9900918331
9986782194
And one more thing all the time "13"," this will be different Ex: . (2 Replies)
Discussion started by: Siddartha
2 Replies
6. UNIX for Dummies Questions & Answers
I have a file, I need to remove the first character of each line, but only if it's a comma. I don't want to delete any other commas in each line.
Trying cat or sed but I really don't know them very well, would love some help.
This removes the first comma, but it removes the first comma no... (6 Replies)
Discussion started by: Cynthia
6 Replies
7. Shell Programming and Scripting
Hi guys,
This is my input
2735:<7001> 34 789 701 2
2774:<7001> 34 789 701 2
How to delete characters after colon :
Including colon : too ?
My output should... (3 Replies)
Discussion started by: gowrishankar05
3 Replies
8. Shell Programming and Scripting
Hi everyone,
suppose that I have the following line:
#test your knowledge
can I use AWK to print the word "test" only? without the #?
what should I change to this:
awk '{print $1}'
thanks in advance guys (2 Replies)
Discussion started by: Abdulelah
2 Replies
9. Shell Programming and Scripting
Hi
I m having ifconfig -a o/p like
sbanlab1:ksh# ifconfig -a | egrep "flags|inet" | awk -F' ' '{print $1,$2}'
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL>
inet 127.0.0.1
lo0:1: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL>
inet 127.0.0.1
bge0:... (1 Reply)
Discussion started by: tarunn.dubeyy
1 Replies
10. Shell Programming and Scripting
Hi
Can anyone tell me how can i remove new line character from a string.
My requirement is to read a line from a file and store it to a string.
read line
string1=$line
read line
string2=$line
echo $string1$string2
The result i am getting in different line. i want the output in the same... (1 Reply)
Discussion started by: sreedivia
1 Replies