Search Results

Search: Posts Made By: viored
1,385
Posted By PikK45
You can also make use of export command :) ...
You can also make use of export command :)

a.sh
#!/bin/sh
echo "Testing 1st script"
x="Came from a.sh"
export $x
b.sh

b.sh
echo "Testing 2nd script"
echo $x
x=$x"Added at b.sh"
echo $x...
1,385
Posted By hanson44
You pass variables from a.sh to b.sh by adding...
You pass variables from a.sh to b.sh by adding the variable after the script name, such as b.sh "$x". You receive variables in b.sh by using $1 for the first variable passed, $2 for the second, etc....
958
Posted By Scott
cut can also read from standard input: $ i=2...
cut can also read from standard input:

$ i=2
$ echo abcde | cut -c$i
b
1,141
Posted By Yoda
awk '/>/{++c;$0=$0 c}1' file
awk '/>/{++c;$0=$0 c}1' file
1,141
Posted By hanson44
$ awk '{ if ($0 == ">") { print $0 n + 1; n++ }...
$ awk '{ if ($0 == ">") { print $0 n + 1; n++ } else { print } }' file
>1
akdfvcnciejcndmdjfk
>2
kdjkkkifjeeeeelfjfuf
>3
fjfhchdejhfhfhfhfhfhf
>4
skdkdhfhvnvncnccm
1,221
Posted By guruprasadpr
One way: awk '/^[^>]/{printf...
One way:

awk '/^[^>]/{printf $0;next}NR!=1{print "";}' file

Guru.
13,033
Posted By Yoda
awk '{F=$2"."$3"."$4".txt";print $NF >>...
awk '{F=$2"."$3"."$4".txt";print $NF >> F;close(F)}' inputfile
13,033
Posted By Yoda
It will be much better if you can show us what...
It will be much better if you can show us what exactly you did, what output you got in code tags rather than just simply saying "the code doesn't do what is requested"

Guru's code should work...
13,033
Posted By guruprasadpr
One way: $ awk '{print > $2"."$3"."$4".txt"...
One way:

$ awk '{print > $2"."$3"."$4".txt" }' file

After running the above awk command:
$ ls 1.10*
1.10.100.txt 1.10.1000.txt 1.10.101.txt

Guru.
Showing results 1 to 9 of 9

 
All times are GMT -4. The time now is 04:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy