02-12-2020
Bash shell script help
Hi everyone, first time poster so I hope you'll be gentle with me.
I am needing some help to make a script in bash to do the following:
For each file with a name beginning with the string
ff_- Extract the first line of the file (the date)
- Change "-" to "/" in the date entry to create a directory path
- Make the directory
- Move the file into the new directory
- Go to the next file
Thank you.
Last edited by rbatte1; 02-21-2020 at 07:46 AM..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi guys!
I have just started with shell programming!!
I am having pronblem with variable subsitutuion.
when i do
egrep "*" marks
this will give me the pattern match.
but how can i catch the output of that result in a variable.
if i say
result = egrep "*" marks
it gives me syntax... (2 Replies)
Discussion started by: vmtailor
2 Replies
2. UNIX for Dummies Questions & Answers
Hi Guys,
I am trying to alter a script for my company.
I need the start of it to go something like this.
User is asked to input 8 numbers
8 numbers are written to a txt file
***** ***** ***** txt file is read ***** *****
The text file gets read in between other files represented by... (2 Replies)
Discussion started by: outthere_3
2 Replies
3. Shell Programming and Scripting
Hi all,
i am beginner to unix and trying out a shell script which does the following. i have to calculate a persons salary. his salary is read from the keyboard. he has two types of deductions. 40% as dearness allowance and 20% as house rent. i have to print the gross salary. here is the code... (5 Replies)
Discussion started by: Irishboy24
5 Replies
4. Shell Programming and Scripting
I need to invoke a program on remote server using ssh in a shell script. In addition i would like to capture date/time and if there is any errors , then script should write to log file. can someone please help me out? (1 Reply)
Discussion started by: sam101
1 Replies
5. Shell Programming and Scripting
Hi,
I have a file in which records contains non ascii characters. The records are comma delimited and quoted.
The non ascii characters are found in a particular column.
Example records
"YY","AK000021","Ã","IO","PP"
"Y1","AK000022","Ã","PO","PP"
"Y2","AK000022","Ã","PO","PP"
I need to... (2 Replies)
Discussion started by: akshu.agni
2 Replies
6. Shell Programming and Scripting
HELP!My program ends after entering one choice---need help making it take multiple inputs,instead of terminating after displaying just one
#!/bin/bash# Crude address databaseclear # Clear the screen.echo " Contact List"echo " ------- ----"echo "Choose one of the following... (6 Replies)
Discussion started by: help123
6 Replies
7. Shell Programming and Scripting
hi guys
we've had nagios spewing false alarm (for the umpteenth time) and finally the customer had enough so they're starting to question nagios. we had the check interval increased from 5 minutes to 2 minutes, but that's just temporary solution. I'm thinking of implementing a script on the... (8 Replies)
Discussion started by: hedkandi
8 Replies
8. Shell Programming and Scripting
I need to create digit day script that takes a single numeric argument and then it should print out the day of the week using the number modulo 7 formula e.g: 0 - Sunday 6- Saturday 131 - Friday
I am fairly new to unix so I don't know how to use the number modulo 7 formula.
Does the script need... (3 Replies)
Discussion started by: lukefrost96
3 Replies
9. Shell Programming and Scripting
So I'm trying to pass certain json elements as env vars and use them later on in a script.
Sample json:
JSON='{
"Element1": "file-123456",
"Element2": "Name, of, company written in, a very weird way",
"Element3": "path/to/some/file.txt",
}'
(part of the) script:
for s... (5 Replies)
Discussion started by: da1
5 Replies
10. UNIX for Beginners Questions & Answers
In Bash shell - the ps -ef shows only the /bin/bash but the script name is not displayed ? Is there any way to get the script names for the process command ?
--- Post updated at 08:39 AM ---
in KSH (Korn Shell), my command output shows the script names but when run in the Bash Shell... (3 Replies)
Discussion started by: i4ismail
3 Replies
CFTP(1) BSD General Commands Manual CFTP(1)
NAME
cftp -- Conch command-line SFTP client
SYNOPSIS
cftp [-B buffer_size] [-b command_file] [-R num_requests] [-s subsystem]
DESCRIPTION
is a client for logging into a remote machine and executing commands to send and receive file information. It can wrap a number of file
transfer subsystems
The options are as follows:
-B Specifies the default size of the buffer to use for sending and receiving. (Default value: 32768 bytes.)
-b File to read commands from, '-' for stdin. (Default value: interactive/stdin.)
-R Number of requests to make before waiting for a reply.
-s Subsystem/server program to connect to.
The following commands are recognised by :
cd path
Change the remote directory to 'path'.
chgrp gid path
Change the gid of 'path' to 'gid'.
chmod mode path
Change mode of 'path' to 'mode'.
chown uid path
Change uid of 'path' to 'uid'.
exit Disconnect from the server.
get remote-path [local-path]
Get remote file and optionally store it at specified local path.
help Get a list of available commands.
lcd path
Change local directory to 'path'.
lls [ls-options [path]]
Display local directory listing.
lmkdir path
Create local directory.
ln linkpath targetpath
Symlink remote file.
lpwd Print the local working directory.
ls [-l [path]]
Display remote directory listing.
mkdir path
Create remote directory.
progress
Toggle progress bar.
put local-path [remote-path]
Transfer local file to remote location
pwd Print the remote working directory.
quit Disconnect from the server.
rename oldpath newpath
Rename remote file.
rmdir path
Remove remote directory.
rm path
Remove remote file.
version
Print the SFTP version.
? Synonym for 'help'.
AUTHOR
cftp by Paul Swartz <z3p@twistedmatrix.com>. Man page by Mary Gardiner <mary@twistedmatrix.com>.
REPORTING BUGS
Report bugs to http://twistedmatrix.com/bugs/
COPYRIGHT
Copyright (C) 2005-2008 Twisted Matrix Laboratories
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
BSD October 8, 2005 BSD