Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: edidataguy
3,292
Posted By edidataguy
Try this:STR=$(strings MR* | grep MoCoseries) ...
Try this:STR=$(strings MR* | grep MoCoseries)
Beware: you have to code for "What happens if the string is not found"
3,292
Posted By edidataguy
From what little info you have given, that is the...
From what little info you have given, that is the basic function of grep.
Show us what you did so far for us to understand your requirement.
May be you should look into "fgrep" instead of "grep".
1,277
Posted By edidataguy
Save what? Can you please tell me how to do it?
Save what? Can you please tell me how to do it?
1,267
Posted By edidataguy
There are different ways to achive this. Try...
There are different ways to achive this.
Try this for one:
$ MYBUILDPATH=/randomstuff/myBuildRoot/data_tables
$ echo $MYBUILDPATH | sed 's~data_tables[/]*$~~'

/randomstuff/myBuildRoot/
$...
1,277
Posted By edidataguy
"exec" command. Stopoutput to file.
I have a script (ksh, Linux) which is about 500 lines and this is only a small requirement. Below is an example of my requirement.

FunctionThis(){
echo "You are in this. Goes to log"
}...
1,900
Posted By edidataguy
Try this: FILE_EXISTS=`ls ${INPUT_DIR}/*.txt...
Try this:
FILE_EXISTS=`ls ${INPUT_DIR}/*.txt 2>/dev/null | wc -l`
4,906
Posted By edidataguy
Try this: echo "john:christina : one::" | sed...
Try this:
echo "john:christina : one::" | sed "s/one::/two:$(date '+%Y%m%d'):/"
1,396
Posted By edidataguy
If it is not sorted then try this: while read...
If it is not sorted then try this:
while read xx ; do
egrep " $xx " file2
done < file1
Not the best. Draw backs:
1. If you have 10,000 records in file1 then you will be calling egrep so many...
6,786
Posted By edidataguy
I have a funny feeling this is a home work. ...
I have a funny feeling this is a home work.
Still. May be this might be good to get started.
tr '[a-z]' 'qweasdzxcrfvbgtyhnmjuiklop' file
May need to add Upper chars, numbers, and the sink.
But...
1,396
Posted By edidataguy
From the data it looks like the data issorted. ...
From the data it looks like the data issorted.
The file1 is sorted.
And file2 is sorted on column 3.
Is this correct?
Then I would consider Unix "paste" is the best command.
8,262
Posted By edidataguy
You can try any one of these: set -A array `tr...
You can try any one of these:
set -A array `tr '[A-Z]' '[a-z]' < file`
set -A array `tr '[[:upper:]]' '[[:lower:]]' < file`
5,506
Posted By edidataguy
This should also work. sed 'N; s/\n/ /' file ...
This should also work.
sed 'N; s/\n/ /' file

Or may be this is what you are looking for:
sed 'N; s~.*/~~; s/\n/ /' file

Or may be this:
sed 'N; s~.*/~~; s~ [^ ]*~~; s/\n/ /' file
1,836
Posted By edidataguy
Try one of these: sed '/<html /,/<\/html>/d'...
Try one of these:
sed '/<html /,/<\/html>/d' inputfile

sed '/<html xmlns="http:\/\/www.w3.org\/1999\/xhtml/,/<\/html>/d' inputfile
22,183
Posted By edidataguy
This will remove all chars after the last space. ...
This will remove all chars after the last space.
sed 's/ [^ ]\+$//' nfile
2,995
Posted By edidataguy
Is this a homework? Because good programmer...
Is this a homework?
Because good programmer will not take this approach.
Usually you come up with an employee ID.
This will be a disaster if there were more than one employee with the same name.
...
2,008
Posted By edidataguy
Not clear what you want. Always post the input...
Not clear what you want.
Always post the input and the output also.


sed -n '/"L1,"/p' myfile # L1 only. Simple straight
sed -n '/"L1,[[:alpha:]]/p' myfile # L1 with MaLR. Regexp...
2,700
Posted By edidataguy
If we we know exactly what is to be done if true...
If we we know exactly what is to be done if true and what if not, then we can give better sugestion. SED also can do afew things, but not assign values. See ifthis is what u r looking 4.
old=''...
3,742
Posted By edidataguy
Oooops....sorry some how I missed it. Then will...
Oooops....sorry some how I missed it.
Then will this work?
sed '/_\${.*schema}/ {/ \${.*schema}/!d;}' file
3,742
Posted By edidataguy
Won't this not work for you? fgrep '_${' file
Won't this not work for you?
fgrep '_${' file
11,094
Posted By edidataguy
sed '/Yr, Month, Prod/', $d' file
sed '/Yr, Month, Prod/', $d' file
4,883
Posted By edidataguy
Your approach is correct. The top loop will get...
Your approach is correct.
The top loop will get one file at a time.
The inner loop, will compare the above first file with all the files in the directory.
The only hitch is, in the inner loop,...
8,823
Posted By edidataguy
Dont use "find". The below should work. ls -1 |...
Dont use "find". The below should work.
ls -1 | egrep " "
4,883
Posted By edidataguy
Not sure what you plan to do with it. But you...
Not sure what you plan to do with it.
But you may find this useful to get started:
y=""
for f in $aDirectory; do
if [ y != "" ]; then
echo "newfile = $f and oldfile = $y"
fi;
...
2,068
Posted By edidataguy
sed 's/[[:alnum:]]*\([0-9]\{5\}\)$/\1/;...
sed 's/[[:alnum:]]*\([0-9]\{5\}\)$/\1/; s/[[:alnum:]]*\([0-9]\{5\}-[0-9]\{4\}\)$/\1/' myfile
1,414
Posted By edidataguy
It could be possible only if there are some fixed...
It could be possible only if there are some fixed conditions.
For eg. take your data.
Field1,Field2,Field3
Field1,ABC,corporation,Field3
1. If you think Filed1 and field3 will never have cammas...
Showing results 1 to 25 of 182

 

Featured Tech Videos

All times are GMT -4. The time now is 12:42 PM.
Unix & Linux Forums Content Copyright 1993-2021. All Rights Reserved.
Privacy Policy