I built a transaction with
cardano-cli shelley transaction build-raw command that has multiple inputs. I have the private keys and .skey files of these addresses but I don't know how to sign the transaction with the cardano-cli. How can I do this?
A single transaction in Cardano can contain many inputs and outputs. As long as the transaction is signed by all the private keys associated with each address, it will be valid. In other words, the number of inputs doesn't effect the number of signatures needed, only the number of unique addresses does, where each unique address requires a signature.
For example, if I have constructed an transaction with an arbitrary number of inputs, but those inputs all come from N-number of unique addresses, the command would be:
cardano-cli transaction sign \ --tx-body-file <RAW_TX_FILE> \ --signing-key-file <SKEY_1_FILE> \ --signing-key-file <SKEY_2_FILE> \ --signing-key-file <SKEY_N_FILE> \ --mainnet \ --out-file <SIGNED_TX_FILE>