I have a script that will be placing a trigger file for other applications.
The user-inputted path is similar to:
The project path will not change throughout the script. However, pwd changes as the scanning continues in the script. I need to truncate everything after the project directory "/data/region/NorthAm/Project HAV 8H" so I can apply specific subdirectories for additional trigger files. There are hundreds of subdirectories under each main project path that is inputted by the user, so I need this to be an efficient script, but I can't seem to figure out how to get this done.
The awk command places spaces in the path, so I know that what I now have doesn't work.
Here is the output of a test run (the touch command commented out for now for obvious reasons)
Is "awk" the only way to get this done? Is there a more efficient way to script this?
Currently I am using this laborious command
lvdisplay | awk '/LV Path/ {p=$3} /LV Name/ {n=$3} /VG Name/ {v=$3} /Block device/ {d=$3; sub(".*:", "/dev/dm-", d); printf "%s\t%s\t%s\n", p, "/dev/mapper/"v"-"n, d}'
Would like to know if there is any shorter method to get this mapping of... (2 Replies)
Hi All,
i had to split one files into 10 equally. For that i have coded below awk.
OUTPUT_FILE=/home/sit/path/Files/file_EXPORT.lst
DIR_NM=`dirname ${OUTPUT_FILE}`
awk -v CURR_DATE="$(date +'%d-%m-%Y-%H-%M')" -v pth=$DIR_NM '{print >> pth/"tgt_file_name"CURR_DATE"_"NR%10 }' ${OUTPUT_FILE}
... (7 Replies)
Hi folks,
I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex.
I have a bunch of update statements with all columns in a file which I need to convert into insert statements.
UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
Hi everyone,
I'm trying to write my first ever shell script, the OS is Raspbian. The code I have written must be executed whenever a certain database has been modified. The database resides on a Windows server to which I have a mount point, and I have no control over the Windows server at all so... (2 Replies)
Can somebody show me a sed or awk command that can parse a pathname
My input will look like this
/u01/app/oracle/diag/rdbms/ifddb1/ifddb1
I would like my output to get rid of everything including the "/" before
diag. So my output will be this diag/rdbms/ifddb1/ifddb1
I need... (1 Reply)
I've been working on a UNIX script (csh) that will be starting a java application
The goal is to get the version number and location (needed by the application) from the path of the script
Example:
Location of the script= /apps/myapp/versionNum/script/start.csh
I need:... (8 Replies)
Hey guys,
I have this file generated by me... i want to create some HTML output from it.
The problem is that i am really confused about how do I go about reading the file.
The file is in the following format:
TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Hi,
I was wondering if it possible to get the path of a variable and compare that to something. Basically I want to write a script that checks if my $JAVA_HOME is correct and if not then it sets it. So far I have...
if ]
then
export JAVA_HOME='/pathhere'
echo JAVA_HOME='/pathhere'
fi
... (6 Replies)
I have a file with a set of insert statements some of which have a single column value that crosses multiple lines causing the statement to fail in sql*plue. Can someone help me with a sed script to replace the new lines with chr(10)?
here is an example:
insert into mytable(id, field1, field2)... (3 Replies)
hello,
I am trying to parse an error returned by a command inside the if statement but it is just displays the full error instead and then stops.
if ; then
echo "no such package"
else
echo "similar version found will use pkgrm"
fi
the above code just displays
please let me know... (2 Replies)