Sponsored Content
Full Discussion: Modifying a variable value
Top Forums UNIX for Dummies Questions & Answers Modifying a variable value Post 302195197 by era on Wednesday 14th of May 2008 01:54:37 PM
Old 05-14-2008
In fact my sort | uniq example was not so far off the mark then.

A variable in Bourne classic is just a piece of text; some shells such as bash and ksh have array variables, too. The common trick would be to modify the text so it is in a suitable form by the time you assign it to a variable.

Code:
var2=$(users | sort | uniq)

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Modifying $PATH variable in /etc/profile

In my /etc/profile, my $PATH variable is set as follows: $PATH =/sbin:/usr/sbin:/usr/bin:/etc Then how do I add an additional directory to it? say /export/home/abd/rose Please advise. Thanks! Deepali (3 Replies)
Discussion started by: Deepali
3 Replies

2. IP Networking

Modifying Route

hello, I have to communicate with a distant station . But Both belong to the same area. So I do not need a gate . But when I make a traceroute, it indicates that I pass through out a gate. What can I do to establish a direct connexion between the both. (with NT ) (1 Reply)
Discussion started by: hoang
1 Replies

3. Shell Programming and Scripting

modifying my shell

Hello, I have installed a new program called chimera under the directory /usr/local/bin/chimera. the executable is under the directory /usr/local/bin/chimera/bin/chimera.e If i put myself under the latest directiry and I type ./chimera, the program works. I would like to avoid this and I... (1 Reply)
Discussion started by: nico-hellas
1 Replies

4. Shell Programming and Scripting

Modifying file from outside

hi , I have a javascript file like this: function fnValidateId(){ var array_id = new Array("444","7888","6633","555","146562","3333","33332") var tmp_id = document.form1.id.value; var num=0; while(1) { if(tmp_id ==... (9 Replies)
Discussion started by: Sreejith_VK
9 Replies

5. Shell Programming and Scripting

.bashrc files modifying the PS1 variable?

Is there a command for finding all files on the system named ".bashrc" that modify the PS1 variable? I'd like to list the full file name(s) and the protection (including the full path). (5 Replies)
Discussion started by: raidkridley
5 Replies

6. UNIX for Dummies Questions & Answers

Modifying rows

Hi, I have a file that looks something like this (2 columns 4 rows): eeeeeeeeeeeeeeeeeeeeeeeeeeeee -45 rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr -24 ttttttttttttttttttttttttttttttttttttttttttt -29 uuuuuuuuuuuuuuuuuuuuuuuuuuu -23 How do I get it to look like this: -45... (3 Replies)
Discussion started by: phil_heath
3 Replies

7. Shell Programming and Scripting

Help with modifying files

Hello everyone, I have some data files, with mixed header formats. the sample for the same is: >ABCD76567.x1 AGTCGATCGTAGTCGTAGCTGT >ABCD76567.y1 AGTCGATCGTAGTCGTAGCTGT >ABCD76568.x1 pair_info:898989 AGTCGATCGTAGTCGTAGCTGT >ABCD76568.y1 pair_info:893489 AGTCGATCGTAGTCGTAGCTGT... (2 Replies)
Discussion started by: ad23
2 Replies

8. Solaris

Setting/Modifying variable specific to target in Makefile

Hi, I have a small piece of Makefile script which throw's error on Sun Sparc machine, but works fine with Sun Optron, Linux, AIX machines. FOO=Naveen test1:FOO=Dhilip test1: @echo FOO is ${FOO} test2: @echo Me is ${FOO} Output on Sun Sparc - ukhml-v890new-~/test: make test1... (5 Replies)
Discussion started by: nsriram
5 Replies

9. Shell Programming and Scripting

Need some help modifying script

I have a script that currently runs fine and I need to add or || (or) condition to the if statement and I'm not sure the exact syntax as it relates to the use of brackets. my current script starts like this: errLog="/usr/local/website-logs/error.log" apacheRestart="service httpd restart"... (3 Replies)
Discussion started by: jjj0923
3 Replies

10. Shell Programming and Scripting

Help with modifying a filename

Hello, I have a filename that looks like this: ABC_96_20141031_041133.232468 I need to shorten only the "_2014" part of the filename to simply "_14" so the filename looks like: ABC_96_141031_041133.232468 I have to do a search for this string because there are hundreds of files and... (17 Replies)
Discussion started by: bbbngowc
17 Replies
UNIQ(1) 							   User Commands							   UNIQ(1)

NAME
uniq - report or omit repeated lines SYNOPSIS
uniq [OPTION]... [INPUT [OUTPUT]] DESCRIPTION
Filter adjacent matching lines from INPUT (or standard input), writing to OUTPUT (or standard output). With no options, matching lines are merged to the first occurrence. Mandatory arguments to long options are mandatory for short options too. -c, --count prefix lines by the number of occurrences -d, --repeated only print duplicate lines -D, --all-repeated[=delimit-method] print all duplicate lines delimit-method={none(default),prepend,separate} Delimiting is done with blank lines -f, --skip-fields=N avoid comparing the first N fields -i, --ignore-case ignore differences in case when comparing -s, --skip-chars=N avoid comparing the first N characters -u, --unique only print unique lines -z, --zero-terminated end lines with 0 byte, not newline -w, --check-chars=N compare no more than N characters in lines --help display this help and exit --version output version information and exit A field is a run of blanks (usually spaces and/or TABs), then non-blank characters. Fields are skipped before chars. Note: 'uniq' does not detect repeated lines unless they are adjacent. You may want to sort the input first, or use `sort -u' without `uniq'. Also, comparisons honor the rules specified by `LC_COLLATE'. AUTHOR
Written by Richard M. Stallman and David MacKenzie. REPORTING BUGS
Report uniq bugs to bug-coreutils@gnu.org GNU coreutils home page: <http://www.gnu.org/software/coreutils/> General help using GNU software: <http://www.gnu.org/gethelp/> Report uniq translation bugs to <http://translationproject.org/team/> COPYRIGHT
Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
comm(1), join(1) The full documentation for uniq is maintained as a Texinfo manual. If the info and uniq programs are properly installed at your site, the command info coreutils 'uniq invocation' should give you access to the complete manual. GNU coreutils 8.5 February 2011 UNIQ(1)
All times are GMT -4. The time now is 06:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy