Search Results

Search: Posts Made By: newbie2010
1,007
Posted By newbie2010
Works perfectly, thanks!
Works perfectly, thanks!
1,007
Posted By newbie2010
How to sort file with certain criteria (bash)?
I am running a command that is part of a script and this is what I am getting when it is sorted by the command:


command:
ls /tmp/test/*NDMP*.z

...
834
Posted By newbie2010
Can't input large file to variable
I have a file that I'm trying to place into a variable.
I've tried the following:

DATE=`date +%Y%m%d`
filez=$(cat /tmp/Test_$DATE.txt)DATE=`date +%Y%m%d`
filez=$(</tmp/Test_$DATE.txt)DATE=`date...
1,006
Posted By newbie2010
Regex with spaces
I have a number of files that I need to return a yes for this command.


CDATE="Feb"
if [[ "$file" =~ [A-Z[:blank:]] && $CDATE="Feb" ]]; then echo "yes";fi


However, the files look like...
1,126
Posted By newbie2010
So should it then look like this? if [[...
So should it then look like this?

if [[ "$file" =~ [A-Z] && $CDATE = "Feb" && $(/opt/csw/bin/gstat "$file" |grep Mod|awk '{print $2}'|cut -b 6,7) -eq 10#02
I believe this probably isn't what you...
1,126
Posted By newbie2010
Problem with gstat and octal value
Here are a few lines from my script. The problem I am having is that the statement for gstat returns this error:

line 43: [[: 08: value too great for base (error token is "08")

The statement...
6,482
Posted By newbie2010
awk -remove pattern from file
I have a file like this - I want to remove the 2015 (or any four digit #) from column $4 so I can get:
Nov 05 1997 /ifs/inventory2/
for example. Im not sure how. Should I use an if statement...
3,555
Posted By newbie2010
Sudo ssh with command running in background
I am trying to run a command. This is one of my attempts:

for i in fileservera; do ssh -t $i 'sudo ls /';doneThis works, and I see the directories. However, what I want to do now is start a...
1,139
Posted By newbie2010
Script to find only files that contain pattern
Actually I googled it and found != *Frequent* works!
So now I have zero questions
Thanks for reading, anyway!

Actually I got this working see below. I just now have one question:

How do you...
5,583
Posted By newbie2010
Creating a directory based on date
I want to create a directory based on date. I do not have date -d command. What I do have is:

either use "date" command to get current date

or DATE1=$(perl -e 'print scalar(localtime(time -...
2,332
Posted By newbie2010
Determine if first 2 digits of string match numbers
Trying to find out how to discover if the first 2 characters of a string are "22"
Not sure how.
I could use

if [[ "$file" =~ 22 ]]; then echo "yes";fi
But I think that will only grab the...
1,178
Posted By newbie2010
Determining length of string
I have this script which is very easy:

file=`echo 01114`
echo $file
01114

then I ran this
if [ $file -ge 7 ]; then echo "yes";fi
it returned yes even though there are only 5 digits there
...
3,072
Posted By newbie2010
awk to change comma separated line to horizontal
I am trying to change a file that looks like this:

file, announcement,date, server, server01, server02, server06, file04, rec01, rec04, rec03... etc

into a vertical file like this:

file...
1,261
Posted By newbie2010
Simple negated test condition
Without grep, I'd like to make a test condition so that any a word that does not have the successive letters car in it will be echoed. for example, bluecar will contain "car" so it will show up as...
1,972
Posted By newbie2010
Regex for (a|b) in bash
I am trying to find files using the following by using simple bash script:

if [[ "$file" =~ (08|8)-[0-9][0-9]-2014 ]]; then echo "yes";fi

What I need to find are any files with date 08-**-2014 ...
2,112
Posted By newbie2010
I need also to run command inside
Thanks for all your responses, they were really helpful!

I was also hoping to run this kind of a command in the array:

for i in `ls -d */ ; do (cd $i; echo $i && ls);done

What this does is...
2,112
Posted By newbie2010
To make it simpler - I want to use an array to cd...
To make it simpler - I want to use an array to cd to different directories. I do want it to be in array format.

#! /bin/bash
i=0
while read line
do
array[ $i ]="$line"
(( i++ ))...
2,112
Posted By newbie2010
Moving files into dirs corresponding to dates
I am trying to find a way to move files into corresponding date files.

i=0
while read line
do
array[ $i ]="$line"
(( i++ ))
done < <(ls)

cd $(echo ${array[1]})
echo ${array[1]}}...
1,119
Posted By newbie2010
Trouble with test pattern
I can run the following command

IFS='\n';ls |grep "02\\-[0-9]\{2\}-2015" |while read file;do cp $file /tmp/feb

However, what I really want to do is if [[ $file =~ "02\\-[0-9]\{2\}-2015" ]];...
1,146
Posted By newbie2010
Multiplying lines of file that contain certain letter by value
I am trying to remove the last letter in a file and then multiply each line (which contained this letter) by 500. This is what I have:

1499998A
1222222A
1325804A
1254556
1235
9998...
1,497
Posted By newbie2010
Sort command, more than one delimiter
I have the following file:
/vol/labor_vol1
/vol/labor_vol10
/vol/labor_vol11
/vol/labor_vol12
/vol/labor_vol13
/vol/labor_vol14
/vol/labor_vol15
/vol/labor_vol16
/vol/labor_vol17...
749
Posted By newbie2010
Regex for CAR- and CAR_
I am trying to find a Regex match for a string: CAR- and CAR_

So I need to match only the letters CAR or a / or a -. So if the word CAR ends in - I need to match it or if it ends in _ I need to...
7,457
Posted By newbie2010
You actually do need bash in front of the script....
You actually do need bash in front of the script. There is something strange about the environment. I found out there were reports of other strange occurrences with any script not written in sh
7,457
Posted By newbie2010
Thanks, everyone of you for all your replies. I...
Thanks, everyone of you for all your replies. I finally figured out how to get around this. Apparently there is sudo - su and sudo bash; these are using different profiles, and the crontab uses the...
7,457
Posted By newbie2010
I still haven't figured this out, but is there a...
I still haven't figured this out, but is there a way to actually run a job as the cron user and see what it is seeing in terms of paths and variables? I can see the crontab is installed under root,...
Showing results 1 to 25 of 204

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