10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
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)
Discussion started by: Francesco_IT
2 Replies
2. Shell Programming and Scripting
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)
Discussion started by: cmccabe
5 Replies
3. Shell Programming and Scripting
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)
Discussion started by: oraclermanpt
2 Replies
4. Shell Programming and Scripting
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)
Discussion started by: Phil27577
2 Replies
5. Shell Programming and Scripting
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)
Discussion started by: josegr
2 Replies
6. Shell Programming and Scripting
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)
Discussion started by: unclecameron
5 Replies
7. Shell Programming and Scripting
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)
Discussion started by: shailesh_arya
7 Replies
8. UNIX for Dummies Questions & Answers
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)
Discussion started by: MaestroRage
3 Replies
9. Shell Programming and Scripting
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)
Discussion started by: sanchopansa
4 Replies
10. Shell Programming and Scripting
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)
Discussion started by: Santiago
3 Replies