Sponsored Content
Top Forums Shell Programming and Scripting Sorting the contents of a variable Post 303035007 by Don Cragun on Friday 10th of May 2019 06:32:27 PM
Old 05-10-2019
Assuming that $OPTIONS does not expand to a string containing anything other than alphanumeric characters and <space>s, one could also use:
Code:
echo $(echo $OPTIONS|tr ' [:upper:]' '\n[:lower:]'|sort -u)

without worrying about having a shell that supports the case modification parameter expansion or the shuf utility which are both extensions to the standards.
This User Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

adding contents of a variable to a command

hi all, i'm new to shell scripting, so i'm not sure how to work this. Is it possible to read in the contents of a variable and add it to a command? for example: ------------------------ #!/bin/sh set example = -dfr rm ${example} ------------------------ when i run the script, i want... (2 Replies)
Discussion started by: gammarays
2 Replies

2. UNIX for Dummies Questions & Answers

Save contents of a Variable

I want to save the contents of a variable to a file. How can that be achieved? I have tried with: echo $varname > textfile.txt but for some reason it does not print anything. (1 Reply)
Discussion started by: carl_vieyra
1 Replies

3. Shell Programming and Scripting

unique sort contents of a variable

Hi , I have #echo $var1 #hdisk2 hdisk3 hdisk0 hdisk2 Now I need to remove duplicate entries from this . ie. after sorting it should only have hdisk2 hdisk3 hdisk0 . I can have these values in a array as well . I understand we can use sort -u to remove the duplicates in a... (2 Replies)
Discussion started by: praveenbvarrier
2 Replies

4. Shell Programming and Scripting

Storing the contents of a file in a variable

There is a file named file.txt whose contents are: +-----------------------------------+-----------+ | Variable_name | Value | +-----------------------------------+-----------+ | Aborted_clients | 0 | | Aborted_connects | 25683... (6 Replies)
Discussion started by: proactiveaditya
6 Replies

5. Shell Programming and Scripting

how to grep the contents of a variable..

Hello All, I've written a script to collect all audit logs files; now i want to see only the files from it which contains certain x tablenames. I've stored all the tablenames in a log file and using it through variable in a script (ex:below) $ more tablenames.log (this is just a samle... (2 Replies)
Discussion started by: suri.tyson
2 Replies

6. Shell Programming and Scripting

How to read contents of a file into variable :(

My file is in this format : username : student information : default shell : student ID Eg : joeb:Joe Bennett:/bin/csh:1234 jerryd:Jerry Daniels:/bin/csh:2345 deaverm: Deaver Michelle:/bin/bash:4356 joseyg:Josey Guerra:/bin/bash:8767 michaelh:Michael Hall:/bin/ksh:1547 I have to... (1 Reply)
Discussion started by: dude_me5
1 Replies

7. Homework & Coursework Questions

How to read contents of a file into variable :(

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I have to read the contents of each field of a file creating user accounts. The file will be of format : ... (6 Replies)
Discussion started by: dude_me5
6 Replies

8. Shell Programming and Scripting

Providing variable contents to awk

Hello, All. This is my first post here, and I expect that the answer is simple, but I can't find it. Might be the way I'm searching. I'm fairly new to Unix/Linux, and I'm writing a Korn Shell Script. I am trying to provide a value that is already in a variable to awk so that awk can pull out the... (3 Replies)
Discussion started by: compguy74
3 Replies

9. Shell Programming and Scripting

Folder contents getting appended as strings while redirecting file contents to a variable

Hi one of the output of the command is as below # sed -n "/CCM-ResourceHealthCheck:/,/---------/{/CCM-ResourceHealthCheck:/d;/---------/d;p;}" Automation.OutputZ$zoneCounter | sed 's/$/<br>/' Resource List : <br> *************************** 1. row ***************************<br> ... (2 Replies)
Discussion started by: vivek d r
2 Replies

10. UNIX for Beginners Questions & Answers

Storing file contents to a variable

Hi All, I was trying a shell script. I was unable to store file contents to a variable in the script. I have tried the below but unable to do it. Input = `cat /path/op.diary` Input = $(<op.diary) I am using ksh shell. I want to store the 'op.diary' file contents to the variable 'Input'... (12 Replies)
Discussion started by: am24
12 Replies
GIT-MERGETOOL(1)                                                    Git Manual                                                    GIT-MERGETOOL(1)

NAME
git-mergetool - Run merge conflict resolution tools to resolve merge conflicts SYNOPSIS
git mergetool [--tool=<tool>] [-y | --[no-]prompt] [<file>...] DESCRIPTION
Use git mergetool to run one of several merge utilities to resolve merge conflicts. It is typically run after git merge. If one or more <file> parameters are given, the merge tool program will be run to resolve differences on each file (skipping those without conflicts). Specifying a directory will include all unresolved files in that path. If no <file> names are specified, git mergetool will run the merge tool program on every file with merge conflicts. OPTIONS
-t <tool>, --tool=<tool> Use the merge resolution program specified by <tool>. Valid values include emerge, gvimdiff, kdiff3, meld, vimdiff, and tortoisemerge. Run git mergetool --tool-help for the list of valid <tool> settings. If a merge resolution program is not specified, git mergetool will use the configuration variable merge.tool. If the configuration variable merge.tool is not set, git mergetool will pick a suitable default. You can explicitly provide a full path to the tool by setting the configuration variable mergetool.<tool>.path. For example, you can configure the absolute path to kdiff3 by setting mergetool.kdiff3.path. Otherwise, git mergetool assumes the tool is available in PATH. Instead of running one of the known merge tool programs, git mergetool can be customized to run an alternative program by specifying the command line to invoke in a configuration variable mergetool.<tool>.cmd. When git mergetool is invoked with this tool (either through the -t or --tool option or the merge.tool configuration variable) the configured command line will be invoked with $BASE set to the name of a temporary file containing the common base for the merge, if available; $LOCAL set to the name of a temporary file containing the contents of the file on the current branch; $REMOTE set to the name of a temporary file containing the contents of the file to be merged, and $MERGED set to the name of the file to which the merge tool should write the result of the merge resolution. If the custom merge tool correctly indicates the success of a merge resolution with its exit code, then the configuration variable mergetool.<tool>.trustExitCode can be set to true. Otherwise, git mergetool will prompt the user to indicate the success of the resolution after the custom tool has exited. --tool-help Print a list of merge tools that may be used with --tool. -y, --no-prompt Don't prompt before each invocation of the merge resolution program. This is the default if the merge resolution program is explicitly specified with the --tool option or with the merge.tool configuration variable. --prompt Prompt before each invocation of the merge resolution program to give the user a chance to skip the path. -O<orderfile> Process files in the order specified in the <orderfile>, which has one shell glob pattern per line. This overrides the diff.orderFile configuration variable (see git-config(1)). To cancel diff.orderFile, use -O/dev/null. TEMPORARY FILES
git mergetool creates *.orig backup files while resolving merges. These are safe to remove once a file has been merged and its git mergetool session has completed. Setting the mergetool.keepBackup configuration variable to false causes git mergetool to automatically remove the backup as files are successfully merged. GIT
Part of the git(1) suite Git 2.17.1 10/05/2018 GIT-MERGETOOL(1)
All times are GMT -4. The time now is 02:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy