Welcome to forums, if you have to print only the file name with a given variable then you could make your life easy by trying following code once.
Thanks,
R. Singh
Last edited by RavinderSingh13; 12-14-2016 at 10:33 AM..
Hi,
does anybody knows about wc -l, how to transform it inot a just number?
this script ALWAYS executes the command3!!, However, the value of BMU_RUNNING is 1
case $BMU_RUNNING in
*0) command1
;;
*1) command 2;;
*)command 3;;
esac
The... (3 Replies)
Hello,
A few days ago I created my amateur version of the cat function in bash. Here is what I've done:
#!/bin/bash
#This is mycat. Similar to cat.
#For detailed information use path/to/mycat.sh -h option
arguments=$#
if ] #in case of standard input
then
while ]
do
read input... (4 Replies)
I have a question to do and it's somewhat confusing. It says, and I quote
"Create a file called file_1 with three lines of text in it. Create a shell variable called "f_name", assign it the string "file_1". Use the cat command and the variable "f_name" to display the contents of the file... (3 Replies)
hello
just i saw a really strange for cat
i have file (file1) contains line /home/rajiv/proj1/*.txt
now applied a commonds
DDPATH="$(cat file1)"
echo $DDPATH
it shows all the txt files in that folder like /home/rajiv/proj1/read1.txt /home/rajiv/proj1/read2.txt... (7 Replies)
I have a file with a single filename in it, which I want to assign to a BASH variable, so I've been trying:
c=$(head -1 somefile)
echo $c
which outputs correctly, but them when I do
...
somecommand $c
it says it can't find the file, is that because it's grabbing the whole line, and... (5 Replies)
I wanted to store a value read from a file in a variable with a given format. I was doing the first step as follows :
it0="$(cat ./myfile)"
I thought the second step would work as: it0= ` printf "%6.3f\n" $it0 `
but it says "./curplot.sh: line 33: 0.035: command not found", although it... (2 Replies)
MyFile contains:
ALTER TABLE $DBN.$TBN
ADD $COL $TYP COMPRESS ($VAL);
I need to cat the file and have it substitute all of the variables with their contents. cat MyFile does not work. The following works for the first line, but errors on the second line because of the paren:
$ while read... (2 Replies)
I am trying to cat on a file located on remote server and assign it to remote variable.
I have both local and remote variables. Running below script from local. test.sh
J_NAME=XXX2
J_IP=XXX
ssh $J_IP "ps auxw |grep java | grep -v grep |grep $J_NAME | awk '{print ... (2 Replies)
As part of a bash the below line strips off a numerical prefix from directory 1 to search for in directory 2.
for file in /home/cmccabe/Desktop/comparison/missing/*.txt
do
file1=${file##*/} # Strip off directory
getprefix=${file1%%_*.txt}
... (5 Replies)
hi all
i have a problem in the bash shell. i'd like insert in a variable a file for example :
i have a file datafine.log in this file there is :
17/JUN/2019
i want to insert the value of datafine.log in a variable.
Regards
Frncesco
edit by bakunin: please use CODE-tags for your data... (2 Replies)