mv $filname $(echo $filename | sed -e 's/.....\.moc1$//');
or
echo ${filename%%?????.moc1}.moc1
%% is a bash internal operator…
More Related Contents:
- Better way to rename files based on multiple patterns
- How can I remove the last character of a file in unix?
- Uppercasing First Letter of Words Using SED
- grep lines that contain 1 character followed by another character
- How to permanently set $PATH on Linux/Unix [closed]
- How to convert DOS/Windows newline (CRLF) to Unix newline (LF) in a Bash script
- How to get overall CPU usage (e.g. 57%) on Linux [closed]
- Aborting a shell script if any command returns a non-zero value
- How to merge two files using AWK? [duplicate]
- What is the difference between using `sh` and `source`?
- Setting environment variables in Linux using Bash
- What does `set -x` do?
- Does “argument list too long” restriction apply to shell builtins?
- Given two directory trees, how can I find out which files differ by content? [closed]
- How do I syntax check a Bash script without running it?
- Using the passwd command from within a shell script
- linux: kill background task
- How do you normalize a file path in Bash?
- Linux/Unix command to determine if process is running?
- How do I get cURL to not show the progress bar?
- How do I remove newlines from a text file?
- Using grep and sed to find and replace a string
- Using `date` command to get previous, current and next month
- How to check if sed has changed a file
- Joining multiple fields in text files on Unix
- How do I delete all lines in a file starting from after a matching line?
- What are the rules for valid identifiers (e.g. functions, vars, etc) in Bash?
- Need to remove the count from the output when using “uniq -c” command
- Creating temporary files in bash
- How do you run a script on login in *nix?