05-12-2004
Then perhaps you agree that your example data could have been clearer! You could use awk...
$ echo 123456| awk '{for(x=1;x<=length;x+=2)s=substr($0,x,2) s}END{print s}'
563412
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
Is there a way to transpose a file in shell scripting? For instance, from
a1 a2 a3 a4 a5 a6 a7 ....
b1 b2 b3 b4 b5 b6 b7 ....
c1 c2 c3 c4 c5 c6 c7 ....
d1 d2 d3 d4 d5 d6 d7 ...
...
...
...
to
a1 b1 c1 d1 ....
a2 b2 c2 d2 ....
a3 b3 c3 d3 ....
a4 b3 c3 d4 ....
...
... (24 Replies)
Discussion started by: mskcc
24 Replies
2. Shell Programming and Scripting
Hello
I need to sort a file with data such as so it breaks on column 1 and all the data in column 2 is sorted into rows with a unique column 1:
1 5
1 6
1 7
2 3
2 4
3 7
3 0
3 9
So it comes out as:
1 5 6 7
2 3 4
3 7 0 9
I've tried many iterations of nawk but can't get it... (14 Replies)
Discussion started by: stevesmith
14 Replies
3. Shell Programming and Scripting
Hello guys,
can some please give driection as to how to archieve this big issue i am having:
I a random number that has been generated and wants the user to guess it, let me illustrate this:
say the random i hve generated is 'nice'
- i then hide it from the user and display it in ----... (3 Replies)
Discussion started by: unibboy
3 Replies
4. UNIX Desktop Questions & Answers
Hi everyone,
I have a poblem like that:
I have a file which includes data looks like:
0.65214 0.3597 1.0
0.65244 0.3502 1.0
0.65273 0.3553 1.0
0.65305 0.3544 1.0
0.65327 0.3505 1.0
0.65359 0.3516 1.0
0.65578 0.6464 1.0
0.65605 0.6453 1.0
0.65633 0.6437 1.0
0.65660 0.6488 1.0... (3 Replies)
Discussion started by: bulash
3 Replies
5. Shell Programming and Scripting
i have a file as:
1
2
3
4
5
i want output as :
1 2 3 4 5
can anybody help on this?? (14 Replies)
Discussion started by: vikas_kesarwani
14 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I've just created a shell script that produces the following output:
hd1 hd3 hd9
/optnonaix/esp /optnonaix/app/oracle /u06
(564.67) (675.97) (678.90)
I would like the output to be as
hd1 /optnonaix/esp (564.67)
hd3 /optnonaix/app/oracle (675.97)
hd9 /u06 (678.90)
Need some... (2 Replies)
Discussion started by: bazzabogan
2 Replies
7. Shell Programming and Scripting
Hi All,
I have a input file say FILEA.
FILEA
--------
empid1
sal1
location1
manager1
empid2
sal2
location2
manager2
empid3
sal3
location3
manager3
.
.
. (3 Replies)
Discussion started by: 46019
3 Replies
8. Shell Programming and Scripting
hey,
I have more a structural problem. I have two input files:
1.inp:
1 2 3 a b c
2 3 4 d f g
and the 2.inp
6 6 6
7 7 7
8 8 8
The goal is to get as much output files (with a name 1_2_3.dat) as lines in 1.inp are like this:
6 6 6 a
7 7 7 b
8 8 8 c (5 Replies)
Discussion started by: ergy1983
5 Replies
9. Shell Programming and Scripting
Hi Guys,
I have file containing this kind of format below:
======== MOBILITY EVENT (G): ATTACH REJECT =========
Time : <date_time>
Node : <node>
GMM Cause : <code>
Details : <details>
Attach : <attach type>
IMSI : <imsi>
PTMSI : <ptmsi>
RA New : <ra new>
RA... (9 Replies)
Discussion started by: rymnd_12345
9 Replies
10. Shell Programming and Scripting
Hi, I need to transpose columns of my files into rows and save it as individual files. sample contents of the file below.
0.9120 0.7782 0.6959 0.6904 0.6322 0.8068 0.9082
0.9290 0.7272 0.9870 0.7648 0.8053 0.8300 0.9520
0.8614 0.6734 0.7910 0.6413 0.7126 0.7364 0.8491
0.8868 0.7586 0.8949... (8 Replies)
Discussion started by: ida1215
8 Replies
LEARN ABOUT REDHAT
checkbashisms
CHECKBASHISMS(1) General Commands Manual CHECKBASHISMS(1)
NAME
checkbashisms - check for bashisms in /bin/sh scripts
SYNOPSIS
checkbashisms script ...
checkbashisms --help|--version
DESCRIPTION
checkbashisms, based on one of the checks from the lintian system, performs basic checks on /bin/sh shell scripts for the possible presence
of bashisms. It takes the names of the shell scripts on the command line, and outputs warnings if possible bashisms are detected.
Note that the definition of a bashism in this context roughly equates to "a shell feature that is not required to be supported by POSIX";
this means that some issues flagged may be permitted under optional sections of POSIX, such as XSI or User Portability.
In cases where POSIX and Debian Policy disagree, checkbashisms by default allows extensions permitted by Policy but may also provide
options for stricter checking.
OPTIONS
--help, -h
Show a summary of options.
--newline, -n
Check for "echo -n" usage (non POSIX but required by Debian Policy 10.4.)
--posix, -p
Check for issues which are non POSIX but required to be supported by Debian Policy 10.4 (implies -n).
--force, -f
Force each script to be checked, even if it would normally not be (for instance, it has a bash or non POSIX shell shebang or appears
to be a shell wrapper).
--extra, -x
Highlight lines which, whilst they do not contain bashisms, may be useful in determining whether a particular issue is a false posi-
tive which may be ignored. For example, the use of "$BASH_ENV" may be preceded by checking whether "$BASH" is set.
--version, -v
Show version and copyright information.
EXIT VALUES
The exit value will be 0 if no possible bashisms or other problems were detected. Otherwise it will be the sum of the following error val-
ues:
1 A possible bashism was detected.
2 A file was skipped for some reason, for example, because it was unreadable or not found. The warning message will give details.
SEE ALSO
lintian(1).
AUTHOR
checkbashisms was originally written as a shell script by Yann Dirson <dirson@debian.org> and rewritten in Perl with many more features by
Julian Gilbey <jdg@debian.org>.
DEBIAN
Debian Utilities CHECKBASHISMS(1)