I have this file (1.txt):
I am using the following script to "trim" the sequence
This is the output:
However, I do not get the expected result when I use the script above in a loop:
Output:
The script is echoing the right string /^.*JOHN|DOE.*$/ but the sequence is not being trimmed.
I do not get the expected output even if I store the string in a variable:
I really cannot see what I am doing wrong here
Any help will be greatly appreciated
PS. I am using the loop to process a bunch of different strings. My bash file will look something like this:
I was wondering how I can modify this for loop, so it only loops through the filenames that do not have an ".old" extension.
for filename in $(ls "$1")
do
echo $filename | grep '\.old$' > /dev/null
if
then mv $1/$filename $1/$filename.old
fi
done (5 Replies)
Hi, my script is waiting for 3 files to come to a folder for 30 min but even when all the files arrive in the folder it's still waiting for these three files. Files can come with in 2 min and I want it to start processing them immediately after all the files arrive in the folder.
until ; do... (3 Replies)
Hi,
I am trying to move a file from remote server to local server and when the transfer completes successfully i call a script in remote server to remove the file which was successfully transferred.
I do this by first getting the list of file in remote server and move the text file to local... (8 Replies)
Simple enough problem I think, I just can't seem to get it right.
The below doesn't work as intended, it's just a function defined in a much larger script:
CheckValues() {
for field in \
Group_ID \
Group_Title \
Rule_ID \
Rule_Severity \
... (2 Replies)
I have a group of variables myLINEcnt1 - myLINEcnt10. I'm trying to printout the values using a for loop. I am at the head banging stage since i'm sure it has to be a basic syntax issue that i can't figure out.
For myIPgrp in 1 2 3 4 5 6 7 8 9 10; do
here i want to output the value of... (4 Replies)
Hello guys,
This truly is a newbie question. I'm trying to make a loop to execute simultaneous commands indefinitely while using variable. Here is how my mess looks like (this is just an example):
#!/bin/bash
IP=`shuf -n 1 IP.txt` # I figured this would be easier to select random lines... (4 Replies)
Hello All,
Maybe I'm Missing something here but I have NOOO idea what the heck is going on with this....?
I have a Variable that contains a PATTERN of what I'm considering "Illegal Characters". So what I'm doing is looping
through a string containing some of these "Illegal Characters". Now... (5 Replies)
Hi All,
I have a file which has hundred of records with fixed number of fields. In each record there is set of 8 characters which represent the duration of that activity. I want to sum up the duration present in all the records for a report. The problem is the duration changes per record so I... (5 Replies)
Hi All,
I am using the below script which has awk command, but it is not returing the expected result. can some pls help me to correct the command.
The below script sample.ksh should give the result if the value of last 4 digits in the variable NM matches with the variable value DAT. The... (7 Replies)
Hi,
i=0
t5=6000001
while
do
i=`expr $i + 1`
t5=`expr $t5 + 1`
echo $t5
done
I am able to increment "col3" value but unable to get col1,col2 value.
Input:
t1=10001
t2=abc
t3=ghkc (5 Replies)