10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Hi,
I am generating a YAML file from a hosts file, but am having trouble saving it to a new file.
hosts file
127.0.0.1 localhost
192.168.1.2 host1
192.168.1.3 host2
192.168.1.4 host3
192.168.1.5 host4
YAML file
$ echo 'host_entries:' && awk '{printf " %s:\n ip:... (3 Replies)
Discussion started by: sand1234
3 Replies
2. Shell Programming and Scripting
Hello,
I've been trying to find the answer to this with Google and trying to browse the forums, but I haven't been able to come up with anything. If this has already been answered, please link me to the thread as I can't find it.
I've been asked to write a script that pulls a list of our CPE... (51 Replies)
Discussion started by: rwalker
51 Replies
3. Shell Programming and Scripting
Hi Experts,
I am trying to get system output to capture inside awk , but not working:
Please advise if this is possible :
I am trying something like this but not working, the output is coming wrong:
echo "" | awk '{d=system ("date") ; print "Current date is:" , d }'
Thanks, (5 Replies)
Discussion started by: rveri
5 Replies
4. Shell Programming and Scripting
Hello all,
I wrote this command line for some calculation on my given input files based on another input file which is a txt file.
while read BAM REGION; do samtools view $BAM $REGION | awk '{if ($2==0) print $0}' | wc -l >>log.txt; echo "$REGION"; done >> log.txt <regions.txt
It takes... (4 Replies)
Discussion started by: @man
4 Replies
5. Shell Programming and Scripting
I have a variable $WORDS that contains a string
Then i want to use sed to break it up.
echo $WORDS | sed 's// /g'
I tried setting this as a variable by doing
WORDS2=`echo $WORDS | sed 's// /g'`
But when i do this it does not return me to the prompt properly
ie.
jmpprd-v1>
jmpprd-v1>... (4 Replies)
Discussion started by: nitrobass24
4 Replies
6. Shell Programming and Scripting
Hi,
I have a problem with passing a echo output into a variable in bash
file='1990.tar'
NAME='echo $file | cut -d '.' -f1';
echo $NAME
the result is
echo $file | cut -d . -f1
however with this one,#!/bin/bash
file='1990.tar'
echo $file | cut -d '.' -f1
the result is what I... (2 Replies)
Discussion started by: 1988PF
2 Replies
7. Shell Programming and Scripting
hi i want to find the size of a folder and assign it to a variable and then compare if it is greater than 1 gb.
i am doin this script, but it is throwing error....
#!/bin/ksh
cd . | du -s | size = awk '{print $1}'
if size >= 112000
then
echo size high
fi
ERROR : (4 Replies)
Discussion started by: Nithz
4 Replies
8. Shell Programming and Scripting
Hi all,
Hope someone can help me out here.
I have this BASH script (see below)
My problem lies with the variable path.
The output of the command find will give me several fields. The 9th field is the path. I want to captured that and the I want to filter this to a specific level.
The... (6 Replies)
Discussion started by: Cowardly
6 Replies
9. Shell Programming and Scripting
Hi All,
Hope someone can advise here as I have been struggling to find a syntax that works here. I have tried a stack of combination I have seed in the forums but I think because I have needed to use "" and `` in the statments another method is found.
I am reading in lines with the following... (1 Reply)
Discussion started by: nkwilliams
1 Replies
10. Shell Programming and Scripting
I understand how to use a variable in a sed command, but for the life of me I can't get the output into a variable.
I'm making a general function to replace part of a filename with a different string, so:
>>myscript this that
would change:
this_file001.txt to that_file001.txt and... (11 Replies)
Discussion started by: donflamenco
11 Replies