10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
For example: I am grepping "Hello" from a file and there are 10 matches. So all ten lines with match will get stored into a variable($match). Now I want to ignore those lines which have "Hi" present in that.
Currently I tried this: match = grep "Hello" file | grep -v "Hi" file
But that's not... (2 Replies)
Discussion started by: pavan
2 Replies
2. Shell Programming and Scripting
The bash bash below extracts the oldest folder from a directory and stores it in filename
That result will match a line in bold in input. In the matching line there is an_xxx digit in italics that
(once the leading zero is removed) will match a line in link. That is the lint to print in output.... (2 Replies)
Discussion started by: cmccabe
2 Replies
3. Shell Programming and Scripting
The sample file:
dept1: user1,user2,user3
dept2: user4,user5,user6
dept3: user7,user8,user9
I want to match by '/^dept2.*/' but don't want to have substring 'dept2:' in output. How to compose such regex? (8 Replies)
Discussion started by: urello
8 Replies
4. Shell Programming and Scripting
hi,
i have a variable which contains some file names delimited by a single space.
FNAME="s1.txt s2.lst s3.cvs s4.lst"
i have another variable that contains a pattern
FILE_PATTERN="*.lst"
i want to take the filenames from FNAME variable and assign each file name in to an array say
for... (8 Replies)
Discussion started by: Little
8 Replies
5. Shell Programming and Scripting
I have a 2 files in .gz format and it consists of 5 million lines the format of the file would be
gzcat file1.gz | more
abcde
aerere
ffgh56
..
..
12345
gzcat file2.gz | more
abcde , 12345 , 67890,
ffgh56 , 45623 ,12334
whatever the string is in the file1 should be matched... (3 Replies)
Discussion started by: aravindj80
3 Replies
6. Shell Programming and Scripting
Hallo!
Example.
#!/bin/bash
BACKUP_DIR=/home/userx/backups/evolution
echo $BACKUP_DIR
# delete the first character from the string
BACKUP_DIR=$(echo $BACKUP_DIR | cut -c 2-)
echo $BACKUP_DIR
It works. It does want I want, delete the first character from string in the... (11 Replies)
Discussion started by: linuxinho
11 Replies
7. Shell Programming and Scripting
Hey there,
I have a table of contents file of the form
1 Title1
1.1 Subtitle1
1.1.1 Subsubtitle1
1.1.2 Subsubtitle2
...
and want to count the number of dots in the first field to find out the level of the section.
I use the gsub function for the job, which works if I pass the pattern... (2 Replies)
Discussion started by: herrsimon
2 Replies
8. Shell Programming and Scripting
Hi all,
I want to search for a data type in a line.For this in a loop i am checking for $DATA_TYPE in a line using grep.But grep is not able to find when i give this.
Can any one tell me how to check string in $DATA_TYPE variable in line usign grep (or) any other way to do the above task.
... (4 Replies)
Discussion started by: jisha
4 Replies
9. Shell Programming and Scripting
hi i am trying to get digits inside brackes from file , whose structure is defined below
CREATE TABLE TELM
(SOC_NO CHAR (3) NOT NULL,
TXN_AMOUNT NUMBER (17,3)
SIGN_ON_TIME CHAR (8)
TELLER_APP_LIMIT NUMBER (17,3)
FIL01 ... (2 Replies)
Discussion started by: zedex
2 Replies
10. Shell Programming and Scripting
Hi All,
I'm trying to test a Hash variable but it's not working. Here is my code - can anyone tell me if the test is valid?
for (keys %enabled_yn) {
if ($enabled_yn{$1} =~ m/\s+Y/) {
$html =~ s/%(\w+)%/\<b\>\<font color\=orange\>$enabled_yn{$1}\<\/font\>\<\/b\>/g;
}... (1 Reply)
Discussion started by: pondlife
1 Replies